`Cannot connect to the Docker daemon` when calling `docker run` inside a local action
Bug report info
act version: 0.2.75
GOOS: darwin
GOARCH: arm64
NumCPU: 12
Docker host: unix:///Users/jameshounshell/.config/colima/default/docker.sock
Sockets found:
Config files:
/Users/jameshounshell/.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.0
Module path: command-line-arguments
Main version:
Main path:
Main checksum:
Build settings:
-buildmode: exe
-compiler: gc
-ldflags: -X main.version=0.2.75
DefaultGODEBUG: gotestjsonbuildtext=1,multipathtcp=0,randseednop=0,rsa1024min=0,tlsmlkem=0,x509rsacrt=0,x509usepolicies=0
CGO_ENABLED: 1
CGO_CFLAGS:
CGO_CPPFLAGS:
CGO_CXXFLAGS:
CGO_LDFLAGS:
GOARCH: arm64
GOOS: darwin
GOARM64: v8.0
Docker Engine:
Engine version: 27.4.0
Engine runtime: runc
Cgroup version: 2
Cgroup driver: cgroupfs
Storage driver: overlay2
Registry URI: https://index.docker.io/v1/
OS: Ubuntu 24.04.1 LTS
OS type: linux
OS version: 24.04
OS arch: x86_64
OS kernel: 6.8.0-50-generic
OS CPU: 2
OS memory: 1963 MB
Security options:
name=apparmor
name=seccomp,profile=builtin
name=cgroupns
Command used with act
act \
workflow_dispatch \
-W ./.github/workflows/_test_local.yaml \
-P self-hosted=catthehacker/ubuntu:act-latest # works with `-self-hosted` on m2 mac
Describe issue
We use an action (composite type, not docker type) to run a little bit of shell then execute a docker run ... command. It appears that the act-latest docker-in-docker is not available to code running inside an action. This is allowed in real Github actions.
Interestingly (but maybe obviously/expectedly?) docker run within the action works fine if I use the -P self-hosted=-self-hosted to run on the mac directly. Also I do set DOCKER_HOST already and even if I try to export it inside the action itself, the socket is not actually there.
I know this is an edge case because you'd probably expect a docker type action with the container that has my dependencies. (for reference the actual image used is registry.k8s.io/kustomize/kustomize:v5.4.2 which I was too lazy to build a custom image for.)
Here's the setup:
.github/workflows/_test_local.yaml --calls--> ./.github/actions/my-action --runs--> docker run ...
.github/workflows/_test_local.yaml
name: local testing
on:
workflow_dispatch:
jobs:
main:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: "." # for local development with ACT you must do this!!!
- name: update
uses: ./.github/actions/my-action
with:
name: James
./.github/actions/my-action/action.yaml
name: 'hello'
description: 'hello'
inputs:
name:
required: true
type: string
description: 'your name'
runs:
using: "composite"
steps:
- id: hello
shell: bash
run: |
docker run \
-v $(pwd):/tmp \
--workdir /tmp/
alpine "echo hello ${{inputs.name}}"
Link to GitHub repository
No response
Workflow content
# see description for workflow content
Relevant log output
docker run \
-v $(pwd):/tmp \
--workdir /tmp/
alpine "echo hello James"
[local testing/step1] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1-composite-hello.sh] user= workdir=
| docker host:
| docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
|
| Run 'docker run --help' for more information