[GH-ISSUE #694] Issue: Container keeps running after exit #440

Closed
opened 2026-03-01 21:43:24 +03:00 by kerem · 11 comments
Owner

Originally created by @KnisterPeter on GitHub (May 20, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/694

Originally assigned to: @catthehacker on GitHub.

Act version

act version 0.2.21

Expected behaviour

All containers started by act should be stopped/exit as soon as act terminates.

Actual behaviour

Not sure in which condition this happens, but some containers never exit.

 322667 ?        Sl     0:03 /usr/bin/containerd-shim-runc-v2 -namespace moby -id xxx -address /run/containerd/containerd.sock
 322687 ?        Ss     0:02  \_ /usr/bin/tail -f /dev/null
CONTAINER ID   IMAGE                      COMMAND                  CREATED        STATUS                    PORTS     NAMES
d4f3d539081e   node:12.20.1-buster-slim   "/usr/bin/tail -f /d…"   19 hours ago   Exited (1) 19 hours ago             act-basic-build
6ca2f7abf602   node:12.20.1-buster-slim   "/usr/bin/tail -f /d…"   19 hours ago   Exited (1) 19 hours ago             act-basic-check
633ba1d2658e   node:12.20.1-buster        "/usr/bin/tail -f /d…"   19 hours ago   Up 19 hours                         act-fail-build

Steps to reproduce

Not sure.

Originally created by @KnisterPeter on GitHub (May 20, 2021). Original GitHub issue: https://github.com/nektos/act/issues/694 Originally assigned to: @catthehacker on GitHub. ## Act version ```none act version 0.2.21 ``` ## Expected behaviour All containers started by act should be stopped/exit as soon as act terminates. ## Actual behaviour Not sure in which condition this happens, but some containers never exit. ```none 322667 ? Sl 0:03 /usr/bin/containerd-shim-runc-v2 -namespace moby -id xxx -address /run/containerd/containerd.sock 322687 ? Ss 0:02 \_ /usr/bin/tail -f /dev/null ``` ```none CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d4f3d539081e node:12.20.1-buster-slim "/usr/bin/tail -f /d…" 19 hours ago Exited (1) 19 hours ago act-basic-build 6ca2f7abf602 node:12.20.1-buster-slim "/usr/bin/tail -f /d…" 19 hours ago Exited (1) 19 hours ago act-basic-check 633ba1d2658e node:12.20.1-buster "/usr/bin/tail -f /d…" 19 hours ago Up 19 hours act-fail-build ``` ## Steps to reproduce Not sure.
Author
Owner

@catthehacker commented on GitHub (May 20, 2021):

If there is at least one fail during workflow then that container will not stop.

<!-- gh-comment-id:844775275 --> @catthehacker commented on GitHub (May 20, 2021): If there is at least one fail during workflow then that container will not stop.
Author
Owner

@KnisterPeter commented on GitHub (May 20, 2021):

Oh, this is a feature? Wasn't aware of that.
And it does block system resources (to an unknown amount).
And keeps ports open (depending on what is done in the containers).

<!-- gh-comment-id:844781094 --> @KnisterPeter commented on GitHub (May 20, 2021): Oh, this is a feature? Wasn't aware of that. And it does block system resources (to an unknown amount). And keeps ports open (depending on what is done in the containers).
Author
Owner

@catthehacker commented on GitHub (May 20, 2021):

Well, it certainly was "expected behaviour" from my point of view that containers don't exit although I've been thinking about making at least a flag to kill all containers, just haven't got around it yet.
Feel free to contribute something in a PR if you want 😺

<!-- gh-comment-id:844823645 --> @catthehacker commented on GitHub (May 20, 2021): Well, it certainly was "expected behaviour" from my point of view that containers don't exit although I've been thinking about making at least a flag to kill all containers, just haven't got around it yet. Feel free to contribute something in a PR if you want 😺
Author
Owner

@aditya-jaroli-by commented on GitHub (May 21, 2021):

Keeping the container alive helps in debugging.

<!-- gh-comment-id:845712916 --> @aditya-jaroli-by commented on GitHub (May 21, 2021): Keeping the container alive helps in debugging.
Author
Owner

@KnisterPeter commented on GitHub (May 21, 2021):

I think there should be an option to either enable or disable this feature. Not sure what a sensible default would be, but I would bet for allow to enable this would be good.

The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take 😃

<!-- gh-comment-id:845717756 --> @KnisterPeter commented on GitHub (May 21, 2021): I think there should be an option to either enable or disable this feature. Not sure what a sensible default would be, but I would bet for allow to enable this would be good. The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take :smiley:
Author
Owner

@catthehacker commented on GitHub (May 21, 2021):

Not sure what a sensible default would be, but I would bet for allow to enable this would be good.

The default behaviour is always current behaviour unless something is completely broken currently.

<!-- gh-comment-id:845728661 --> @catthehacker commented on GitHub (May 21, 2021): > Not sure what a sensible default would be, but I would bet for allow to enable this would be good. The default behaviour is always current behaviour unless something is completely broken currently.
Author
Owner

@catthehacker commented on GitHub (May 21, 2021):

The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take 😃

That's probably because you want to run the workflow and some people want to create an actions for GHA. It's reasonable for a container to not exit when it had issue so it could be debugged.

<!-- gh-comment-id:845731955 --> @catthehacker commented on GitHub (May 21, 2021): > The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take 😃 That's probably because you want to run the workflow and some people want to create an actions for GHA. It's reasonable for a container to not exit when it had issue so it could be debugged.
Author
Owner

@ayozemr commented on GitHub (May 24, 2021):

The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take 😃

That's probably because you want to run the workflow and some people want to create an actions for GHA. It's reasonable for a container to not exit when it had issue so it could be debugged.

Agreed, I use it to create actions... But I also think an argument to keep the container running will be good... like in CircleCI when you tell to keep ssh open to debug.. its not the normal usage but good to have it.

Thanks!!

<!-- gh-comment-id:847191945 --> @ayozemr commented on GitHub (May 24, 2021): > > The default behavior of act shouldn't probably to debug something but to run a workflow. And when finished, every system resource should be freed. But thats just my take 😃 > > That's probably because you want to run the workflow and some people want to create an actions for GHA. It's reasonable for a container to not exit when it had issue so it could be debugged. Agreed, I use it to create actions... But I also think an argument to keep the container running will be good... like in CircleCI when you tell to keep ssh open to debug.. its not the normal usage but good to have it. Thanks!!
Author
Owner

@ggoretkin-bdai commented on GitHub (Feb 16, 2023):

I was looking for a way to keep the container running, and google brought me here.

The relevant flag is

  -r, --reuse                                             don't remove container(s) on successfully completed workflow(s) to maintain state between runs
<!-- gh-comment-id:1433602009 --> @ggoretkin-bdai commented on GitHub (Feb 16, 2023): I was looking for a way to *keep* the container running, and google brought me here. The relevant flag is ``` -r, --reuse don't remove container(s) on successfully completed workflow(s) to maintain state between runs ```
Author
Owner

@alexfornuto commented on GitHub (Jun 18, 2024):

Thanks to @ggoretkin-bdai and his >1 year old comment, which has come in clutch for me. Is this and other flags listed on the docs site (nektosact.com) somewhere and I just missed it? If not, shouldn't it be?

<!-- gh-comment-id:2177211871 --> @alexfornuto commented on GitHub (Jun 18, 2024): Thanks to @ggoretkin-bdai and his >1 year old comment, which has come in clutch for me. Is this and other flags listed on the docs site (`nektosact.com`) somewhere and I just missed it? If not, shouldn't it be?
Author
Owner

@YoraiLevi commented on GitHub (Nov 4, 2024):

Thanks to @ggoretkin-bdai and his >1 year old comment, which has come in clutch for me. Is this and other flags listed on the docs site (nektosact.com) somewhere and I just missed it? If not, shouldn't it be?

googling github act "--reuse" leads to no meaningful documentation
However, 👇️ seem like a good enough documentation.
from now on i am using --rm as a default

$ act --help
Run GitHub actions locally by specifying the event name (e.g. `push`) or an action name directly.

Usage:
  act [event name to run] [flags]

If no event name passed, will default to "on: push"
If actions handles only one event it will be used as default instead of "on: push"

Flags:
      --action-cache-path string                          Defines the path where the actions get cached and host workspaces created. (default "/mnt/nvme/btrfs/yorai/.cache/act")
      --action-offline-mode                               If action contents exists, it will not be fetch and pull again. If turn on this,will turn off force pull
  -a, --actor string                                      user that triggered the event (default "nektos/act")
      --artifact-server-addr string                       Defines the address to which the artifact server binds. (default "192.168.2.200")
      --artifact-server-path string                       Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start.
      --artifact-server-port string                       Defines the port where the artifact server listens. (default "34567")
  -b, --bind                                              bind working directory to container, rather than copy
      --bug-report                                        Display system information for bug report
      --cache-server-addr string                          Defines the address to which the cache server binds. (default "192.168.2.200")
      --cache-server-path string                          Defines the path where the cache server stores caches. (default "/mnt/nvme/btrfs/yorai/.cache/actcache")
      --cache-server-port uint16                          Defines the port where the artifact server listens. 0 means a randomly available port.
      --container-architecture string                     Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.
      --container-cap-add stringArray                     kernel capabilities to add to the workflow containers (e.g. --container-cap-add SYS_PTRACE)
      --container-cap-drop stringArray                    kernel capabilities to remove from the workflow containers (e.g. --container-cap-drop SYS_PTRACE)
      --container-daemon-socket string                    URI to Docker Engine socket (e.g.: unix://~/.docker/run/docker.sock or - to disable bind mounting the socket)
      --container-options string                          Custom docker container options for the job container without an options property in the job definition
      --defaultbranch string                              the name of the main branch
      --detect-event                                      Use first event type from workflow as event that triggered the workflow
  -C, --directory string                                  working directory (default ".")
  -n, --dryrun                                            disable container creation, validates only workflow correctness
      --env stringArray                                   env to make available to actions with optional value (e.g. --env myenv=foo or --env myenv)
      --env-file string                                   environment file to read and use as env in the containers (default ".env")
  -e, --eventpath string                                  path to event JSON file
      --github-instance string                            GitHub instance to use. Only use this when using GitHub Enterprise Server. (default "github.com")
  -g, --graph                                             draw workflows
  -h, --help                                              help for act
      --input stringArray                                 action input to make available to actions (e.g. --input myinput=foo)
      --input-file string                                 input file to read and use as action input (default ".input")
      --insecure-secrets                                  NOT RECOMMENDED! Doesn't hide secrets while printing logs.
  -j, --job string                                        run a specific job ID
      --json                                              Output logs in json format
  -l, --list                                              list workflows
      --local-repository stringArray                      Replaces the specified repository and ref with a local folder (e.g. https://github.com/test/test@v0=/home/act/test or test/test@v0=/home/act/test, the latter matches any hosts or protocols)
      --log-prefix-job-id                                 Output the job id within non-json logs instead of the entire name
      --man-page                                          Print a generated manual page to stdout
      --matrix stringArray                                specify which matrix configuration to include (e.g. --matrix java:13
      --network string                                    Sets a docker network name. Defaults to host. (default "host")
      --no-cache-server                                   Disable cache server
      --no-recurse                                        Flag to disable running workflows from subdirectories of specified path in '--workflows'/'-W' flag
      --no-skip-checkout                                  Do not skip actions/checkout
  -P, --platform stringArray                              custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)
      --privileged                                        use privileged mode
  -p, --pull                                              pull docker image(s) even if already present (default true)
  -q, --quiet                                             disable logging of output from steps
      --rebuild                                           rebuild local action docker image(s) even if already present (default true)
      --remote-name string                                git remote name that will be used to retrieve url of git repo (default "origin")
      --replace-ghe-action-token-with-github-com string   If you are using replace-ghe-action-with-github-com  and you want to use private actions on GitHub, you have to set personal access token
      --replace-ghe-action-with-github-com stringArray    If you are using GitHub Enterprise Server and allow specified actions from GitHub (github.com), you can set actions on this. (e.g. --replace-ghe-action-with-github-com =github/super-linter)
  -r, --reuse                                             don't remove container(s) on successfully completed workflow(s) to maintain state between runs
      --rm                                                automatically remove container(s)/volume(s) after a workflow(s) failure
  -s, --secret stringArray                                secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)
      --secret-file string                                file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets")
      --use-gitignore                                     Controls whether paths specified in .gitignore should be copied into container (default true)
      --use-new-action-cache                              Enable using the new Action Cache for storing Actions locally
      --userns string                                     user namespace to use
      --var stringArray                                   variable to make available to actions with optional value (e.g. --var myvar=foo or --var myvar)
      --var-file string                                   file with list of vars to read from (e.g. --var-file .vars) (default ".vars")
  -v, --verbose                                           verbose output
      --version                                           version for act
  -w, --watch                                             watch the contents of the local repo and run when files change
  -W, --workflows string                                  path to workflow file(s) (default "./.github/workflows/")
<!-- gh-comment-id:2453646135 --> @YoraiLevi commented on GitHub (Nov 4, 2024): > Thanks to @ggoretkin-bdai and his >1 year old comment, which has come in clutch for me. Is this and other flags listed on the docs site (`nektosact.com`) somewhere and I just missed it? If not, shouldn't it be? googling github act "--reuse" leads to no meaningful documentation However, 👇️ seem like a good enough documentation. from now on i am using `--rm` as a default ``` $ act --help Run GitHub actions locally by specifying the event name (e.g. `push`) or an action name directly. Usage: act [event name to run] [flags] If no event name passed, will default to "on: push" If actions handles only one event it will be used as default instead of "on: push" Flags: --action-cache-path string Defines the path where the actions get cached and host workspaces created. (default "/mnt/nvme/btrfs/yorai/.cache/act") --action-offline-mode If action contents exists, it will not be fetch and pull again. If turn on this,will turn off force pull -a, --actor string user that triggered the event (default "nektos/act") --artifact-server-addr string Defines the address to which the artifact server binds. (default "192.168.2.200") --artifact-server-path string Defines the path where the artifact server stores uploads and retrieves downloads from. If not specified the artifact server will not start. --artifact-server-port string Defines the port where the artifact server listens. (default "34567") -b, --bind bind working directory to container, rather than copy --bug-report Display system information for bug report --cache-server-addr string Defines the address to which the cache server binds. (default "192.168.2.200") --cache-server-path string Defines the path where the cache server stores caches. (default "/mnt/nvme/btrfs/yorai/.cache/actcache") --cache-server-port uint16 Defines the port where the artifact server listens. 0 means a randomly available port. --container-architecture string Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms. --container-cap-add stringArray kernel capabilities to add to the workflow containers (e.g. --container-cap-add SYS_PTRACE) --container-cap-drop stringArray kernel capabilities to remove from the workflow containers (e.g. --container-cap-drop SYS_PTRACE) --container-daemon-socket string URI to Docker Engine socket (e.g.: unix://~/.docker/run/docker.sock or - to disable bind mounting the socket) --container-options string Custom docker container options for the job container without an options property in the job definition --defaultbranch string the name of the main branch --detect-event Use first event type from workflow as event that triggered the workflow -C, --directory string working directory (default ".") -n, --dryrun disable container creation, validates only workflow correctness --env stringArray env to make available to actions with optional value (e.g. --env myenv=foo or --env myenv) --env-file string environment file to read and use as env in the containers (default ".env") -e, --eventpath string path to event JSON file --github-instance string GitHub instance to use. Only use this when using GitHub Enterprise Server. (default "github.com") -g, --graph draw workflows -h, --help help for act --input stringArray action input to make available to actions (e.g. --input myinput=foo) --input-file string input file to read and use as action input (default ".input") --insecure-secrets NOT RECOMMENDED! Doesn't hide secrets while printing logs. -j, --job string run a specific job ID --json Output logs in json format -l, --list list workflows --local-repository stringArray Replaces the specified repository and ref with a local folder (e.g. https://github.com/test/test@v0=/home/act/test or test/test@v0=/home/act/test, the latter matches any hosts or protocols) --log-prefix-job-id Output the job id within non-json logs instead of the entire name --man-page Print a generated manual page to stdout --matrix stringArray specify which matrix configuration to include (e.g. --matrix java:13 --network string Sets a docker network name. Defaults to host. (default "host") --no-cache-server Disable cache server --no-recurse Flag to disable running workflows from subdirectories of specified path in '--workflows'/'-W' flag --no-skip-checkout Do not skip actions/checkout -P, --platform stringArray custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04) --privileged use privileged mode -p, --pull pull docker image(s) even if already present (default true) -q, --quiet disable logging of output from steps --rebuild rebuild local action docker image(s) even if already present (default true) --remote-name string git remote name that will be used to retrieve url of git repo (default "origin") --replace-ghe-action-token-with-github-com string If you are using replace-ghe-action-with-github-com and you want to use private actions on GitHub, you have to set personal access token --replace-ghe-action-with-github-com stringArray If you are using GitHub Enterprise Server and allow specified actions from GitHub (github.com), you can set actions on this. (e.g. --replace-ghe-action-with-github-com =github/super-linter) -r, --reuse don't remove container(s) on successfully completed workflow(s) to maintain state between runs --rm automatically remove container(s)/volume(s) after a workflow(s) failure -s, --secret stringArray secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret) --secret-file string file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets") --use-gitignore Controls whether paths specified in .gitignore should be copied into container (default true) --use-new-action-cache Enable using the new Action Cache for storing Actions locally --userns string user namespace to use --var stringArray variable to make available to actions with optional value (e.g. --var myvar=foo or --var myvar) --var-file string file with list of vars to read from (e.g. --var-file .vars) (default ".vars") -v, --verbose verbose output --version version for act -w, --watch watch the contents of the local repo and run when files change -W, --workflows string path to workflow file(s) (default "./.github/workflows/") ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#440
No description provided.