[GH-ISSUE #2727] act doesn't work when setting shell to docker exec .... #1235

Closed
opened 2026-03-01 21:49:51 +03:00 by kerem · 1 comment
Owner

Originally created by @siferati on GitHub (Apr 10, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2727

Bug report info

act version:            0.2.76
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
Config files:           
	/home/siferati/.config/act/actrc:
		-P ubuntu-latest=catthehacker/ubuntu:act-latest
		-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
		-P ubuntu-20.04=catthehacker/ubuntu:act-20.04
		-P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
	Go version:            go1.24.1
	Module path:           github.com/nektos/act
	Main version:          v0.2.76
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.76 -X main.commit=4f4913f9f34da9f349bf4f842c56e9d7f8af3729 -X main.date=2025-04-01T02:36:03Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         4f4913f9f34da9f349bf4f842c56e9d7f8af3729
		vcs.time:             2025-04-01T02:35:41Z
		vcs.modified:         false
Docker Engine:
	Engine version:        28.0.4
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         systemd
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Ubuntu 22.04.5 LTS
	OS type:               linux
	OS version:            22.04
	OS arch:               x86_64
	OS kernel:             6.8.0-57-generic
	OS CPU:                16
	OS memory:             31853 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act --workflows ".github/workflows/debug.yml"

Describe issue

Most of my workflows require building a docker image, starting a container and then executing commands inside it.

  1. docker build ...
  2. docker run ...
  3. docker exec ...

I can run multiple commands inside the container via docker exec foo bash -c "cmd1 && cmd2 && cmd3".
But this is not manageable for complex operations, and so I tend to use jobs.<job_id>.steps[*].shell instead.

- shell: docker exec foo bash -e {0}
  run: echo "Hello world"

For this to work it requires mounting ${{ runner.temp }}, as that's where the temporary file that contains the commands specified in the run keyword is stored.

--mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }}

Unfortunately, this doesn't seem to work for act, as you can see from the logs below.
I've tried instead mounting /var/run/act/workflow, but that also doesn't work as it tries to mount from the host system instead of the docker container.
And of course that folder does not exist on the host system.
I guess it's related with running docker inside docker...

I've attached a workflow below with a minimum example.
How can I make act work for my use case?

Workflow content

name: Debug

on: push

jobs:
  debug:
    runs-on: ubuntu-22.04
    steps:
      # this works fine
      - shell: bash -e {0}
        run: echo "Hello world"

      - name: start container
        run: >-
          docker run
          --name foo
          --detach
          --tty
          --mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }}
          ubuntu:22.04
      
      # this fails
      - shell: docker exec foo bash -e {0}
        run: echo "Hello world"

Relevant log output

INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
[Debug/debug] ⭐ Run Set up job
[Debug/debug] 🚀  Start image=catthehacker/ubuntu:act-22.04
[Debug/debug]   🐳  docker pull image=catthehacker/ubuntu:act-22.04 platform= username= forcePull=true
[Debug/debug]   🐳  docker create image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Debug/debug]   🐳  docker run image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Debug/debug]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[Debug/debug]   ✅  Success - Set up job
[Debug/debug] ⭐ Run Main echo "Hello world"
[Debug/debug]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/0] user= workdir=
| Hello world
[Debug/debug]   ✅  Success - Main echo "Hello world" [111.707601ms]
[Debug/debug] ⭐ Run Main start container
[Debug/debug]   🐳  docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir=
| a9dd3f5cdd58beb38423dcd8492def0f83d51bac8ddfbd9e2e53fa1342fc36cd
[Debug/debug]   ✅  Success - Main start container [240.312769ms]
[Debug/debug] ⭐ Run Main echo "Hello world"
[Debug/debug]   🐳  docker exec cmd=[docker exec foo bash -e /var/run/act/workflow/2] user= workdir=
| bash: /var/run/act/workflow/2: No such file or directory
[Debug/debug]   ❌  Failure - Main echo "Hello world" [173.559343ms]
[Debug/debug] exitcode '1': failure
[Debug/debug] ⭐ Run Complete job
[Debug/debug]   ✅  Success - Complete job
[Debug/debug] 🏁  Job failed
Error: Job 'debug' failed
Originally created by @siferati on GitHub (Apr 10, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2727 ### Bug report info ```plain text act version: 0.2.76 GOOS: linux GOARCH: amd64 NumCPU: 16 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/siferati/.config/act/actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.24.1 Module path: github.com/nektos/act Main version: v0.2.76 Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -s -w -X main.version=0.2.76 -X main.commit=4f4913f9f34da9f349bf4f842c56e9d7f8af3729 -X main.date=2025-04-01T02:36:03Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 4f4913f9f34da9f349bf4f842c56e9d7f8af3729 vcs.time: 2025-04-01T02:35:41Z vcs.modified: false Docker Engine: Engine version: 28.0.4 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 22.04.5 LTS OS type: linux OS version: 22.04 OS arch: x86_64 OS kernel: 6.8.0-57-generic OS CPU: 16 OS memory: 31853 MB Security options: name=apparmor name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act --workflows ".github/workflows/debug.yml" ``` ### Describe issue Most of my workflows require building a docker image, starting a container and then executing commands inside it. 1. `docker build ...` 2. `docker run ... ` 3. `docker exec ...` I can run multiple commands inside the container via `docker exec foo bash -c "cmd1 && cmd2 && cmd3"`. But this is not manageable for complex operations, and so I tend to use [`jobs.<job_id>.steps[*].shell`](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell) instead. ```yaml - shell: docker exec foo bash -e {0} run: echo "Hello world" ``` For this to work it requires mounting `${{ runner.temp }}`, as that's where the temporary file that contains the commands specified in the `run` keyword is stored. ```yaml --mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }} ``` Unfortunately, this doesn't seem to work for `act`, as you can see from the logs below. I've tried instead mounting `/var/run/act/workflow`, but that also doesn't work as it tries to mount from the host system instead of the docker container. And of course that folder does not exist on the host system. I guess it's related with running docker inside docker... I've attached a workflow below with a minimum example. How can I make `act` work for my use case? ### Workflow content ```yml name: Debug on: push jobs: debug: runs-on: ubuntu-22.04 steps: # this works fine - shell: bash -e {0} run: echo "Hello world" - name: start container run: >- docker run --name foo --detach --tty --mount type=bind,source=${{ runner.temp }},target=${{ runner.temp }} ubuntu:22.04 # this fails - shell: docker exec foo bash -e {0} run: echo "Hello world" ``` ### Relevant log output ```sh INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' [Debug/debug] ⭐ Run Set up job [Debug/debug] 🚀 Start image=catthehacker/ubuntu:act-22.04 [Debug/debug] 🐳 docker pull image=catthehacker/ubuntu:act-22.04 platform= username= forcePull=true [Debug/debug] 🐳 docker create image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Debug/debug] 🐳 docker run image=catthehacker/ubuntu:act-22.04 platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Debug/debug] 🐳 docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir= [Debug/debug] ✅ Success - Set up job [Debug/debug] ⭐ Run Main echo "Hello world" [Debug/debug] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/0] user= workdir= | Hello world [Debug/debug] ✅ Success - Main echo "Hello world" [111.707601ms] [Debug/debug] ⭐ Run Main start container [Debug/debug] 🐳 docker exec cmd=[bash -e /var/run/act/workflow/1] user= workdir= | a9dd3f5cdd58beb38423dcd8492def0f83d51bac8ddfbd9e2e53fa1342fc36cd [Debug/debug] ✅ Success - Main start container [240.312769ms] [Debug/debug] ⭐ Run Main echo "Hello world" [Debug/debug] 🐳 docker exec cmd=[docker exec foo bash -e /var/run/act/workflow/2] user= workdir= | bash: /var/run/act/workflow/2: No such file or directory [Debug/debug] ❌ Failure - Main echo "Hello world" [173.559343ms] [Debug/debug] exitcode '1': failure [Debug/debug] ⭐ Run Complete job [Debug/debug] ✅ Success - Complete job [Debug/debug] 🏁 Job failed Error: Job 'debug' failed ```
kerem 2026-03-01 21:49:51 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@siferati commented on GitHub (May 13, 2025):

<!-- gh-comment-id:2874927914 --> @siferati commented on GitHub (May 13, 2025): - Closing in favor of https://github.com/nektos/act/issues/2751
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#1235
No description provided.