[GH-ISSUE #1498] Honor docker context #766

Open
opened 2026-03-01 21:46:11 +03:00 by kerem · 6 comments
Owner

Originally created by @macmiranda on GitHub (Dec 9, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1498

Act version

act version 0.2.34

Feature description

act does not honor docker context or --container-daemon-socket

❯ docker context use default
default
Current context is now "default"
❯ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
❯ docker context use colima-docker
colima-docker
Current context is now "colima-docker"
❯ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
❯ act
ERRO[0000] failed to obtain container engine info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 
[aws-github.yml/Deploy] 🚀  Start image=catthehacker/ubuntu:act-latest
[aws-github.yml/Deploy]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false
Error: unable to determine if image already exists for image 'catthehacker/ubuntu:act-latest' (): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
❯ act --container-daemon-socket "/Users/maurelio/.colima/docker/docker.sock"
ERRO[0000] failed to obtain container engine info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 
[aws-github.yml/Deploy] 🚀  Start image=catthehacker/ubuntu:act-latest
[aws-github.yml/Deploy]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false
Error: unable to determine if image already exists for image 'catthehacker/ubuntu:act-latest' (): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Originally created by @macmiranda on GitHub (Dec 9, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1498 ### Act version act version 0.2.34 ### Feature description act does not honor docker context or `--container-daemon-socket` ``` ❯ docker context use default default Current context is now "default" ❯ docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ❯ docker context use colima-docker colima-docker Current context is now "colima-docker" ❯ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ❯ act ERRO[0000] failed to obtain container engine info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [aws-github.yml/Deploy] 🚀 Start image=catthehacker/ubuntu:act-latest [aws-github.yml/Deploy] 🐳 docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false Error: unable to determine if image already exists for image 'catthehacker/ubuntu:act-latest' (): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ``` ``` ❯ act --container-daemon-socket "/Users/maurelio/.colima/docker/docker.sock" ERRO[0000] failed to obtain container engine info: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [aws-github.yml/Deploy] 🚀 Start image=catthehacker/ubuntu:act-latest [aws-github.yml/Deploy] 🐳 docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=false Error: unable to determine if image already exists for image 'catthehacker/ubuntu:act-latest' (): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ```
Author
Owner

@bergarces commented on GitHub (Dec 12, 2022):

I'm having this same issue.
Ubuntu 22.04
Docker Desktop 4.15.0

<!-- gh-comment-id:1346338720 --> @bergarces commented on GitHub (Dec 12, 2022): I'm having this same issue. Ubuntu 22.04 Docker Desktop 4.15.0
Author
Owner

@adamgilman commented on GitHub (Dec 27, 2022):

You can "fake" this until the issue is resolved by symlinking the sock file

sudo ln /Users/adamgilman/.colima/default/docker.sock /var/run/docker.sock

<!-- gh-comment-id:1366153900 --> @adamgilman commented on GitHub (Dec 27, 2022): You can "fake" this until the issue is resolved by symlinking the sock file `sudo ln /Users/adamgilman/.colima/default/docker.sock /var/run/docker.sock `
Author
Owner

@catthehacker commented on GitHub (Jan 3, 2023):

there is no need for symlink, act supports DOCKER_HOST like other docker tools

<!-- gh-comment-id:1370048247 --> @catthehacker commented on GitHub (Jan 3, 2023): there is no need for symlink, act supports `DOCKER_HOST` like other docker tools
Author
Owner

@catthehacker commented on GitHub (Jan 3, 2023):

https://github.com/nektos/act/wiki/Custom-container-engine

<!-- gh-comment-id:1370048599 --> @catthehacker commented on GitHub (Jan 3, 2023): https://github.com/nektos/act/wiki/Custom-container-engine
Author
Owner

@kishaningithub commented on GitHub (Feb 27, 2023):

You can also run the following command

export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}}')

This is documented here in readme

<!-- gh-comment-id:1446311762 --> @kishaningithub commented on GitHub (Feb 27, 2023): You can also run the following command ```bash export DOCKER_HOST=$(docker context inspect --format '{{.Endpoints.docker.Host}}') ``` This is documented [here in readme](https://github.com/nektos/act#docker-context-support)
Author
Owner

@a0s commented on GitHub (Oct 8, 2024):

So, i have

INFO[0000] Using docker host 'unix:///Users/a0s/.docker/run/docker.sock', and daemon socket '-' 
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠  

at the start of job,
then in the middle of logs

docker exec cmd=[bash -e /var/run/act/workflow/5] user= workdir=
| ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Also i have

echo $DOCKER_HOST                                                                                                             
unix:///Users/a0s/.docker/run/docker.sock

and symlinked /var/run/docker.sock

> ls -all /var/run/docker*                                   
srwxr-xr-x@ 2 a0s  staff  0 Oct  8 01:05 /var/run/docker.sock
> docker context show
default

And it still fails. How to fix it?

<!-- gh-comment-id:2399532271 --> @a0s commented on GitHub (Oct 8, 2024): So, i have ``` INFO[0000] Using docker host 'unix:///Users/a0s/.docker/run/docker.sock', and daemon socket '-' WARN ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠ ``` at the start of job, then in the middle of logs ``` docker exec cmd=[bash -e /var/run/act/workflow/5] user= workdir= | ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ``` Also i have ``` echo $DOCKER_HOST unix:///Users/a0s/.docker/run/docker.sock ``` and symlinked /var/run/docker.sock ``` > ls -all /var/run/docker* srwxr-xr-x@ 2 a0s staff 0 Oct 8 01:05 /var/run/docker.sock ``` ``` > docker context show default ``` And it still fails. How to fix it?
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#766
No description provided.