act icon indicating copy to clipboard operation
act copied to clipboard

Honor docker context

Open macmiranda opened this issue 2 years ago • 6 comments
trafficstars

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?

macmiranda avatar Dec 09 '22 10:12 macmiranda

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

bergarces avatar Dec 12 '22 11:12 bergarces

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

adamgilman avatar Dec 27 '22 20:12 adamgilman

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

catthehacker avatar Jan 03 '23 17:01 catthehacker

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

catthehacker avatar Jan 03 '23 17:01 catthehacker

You can also run the following command

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

This is documented here in readme

kishaningithub avatar Feb 27 '23 13:02 kishaningithub