act: Issue: cannot connect to Docker daemon

System information

  • Operating System: macOS
  • Architecture: arm64
  • Apple M1: yes
  • Docker version:
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.5
 Git commit:        e91ed5707e
 Built:             Sun Dec 12 06:28:24 2021
 OS/Arch:           darwin/arm64
 Context:           colima
 Experimental:      true

Server:
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.4
  Git commit:       847da184ad5048b27f5bdf9d53d070f731b43180
  Built:            Fri Nov 19 03:41:34 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.5.8
  GitCommit:        1e5ef943eb76627a6d3b6de8cd1ef6537f393a71
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:
  • Docker image used in act: -
  • act version: act version 0.2.25

Expected behaviour

the act can run

Actual behaviour

the act always ask regarding the docker is running. Is the docker daemon running?

but when I pull the image manually it works

Workflow and/or repository

on:
  pull_request:
    branches: [master]
env:
  HOME: "/home/runner/****
  GOPRIVATE: "github.com/***/*"
  GOPATH: ${{ github.workspace }}/go
  GO111MODULE: on
jobs:
  golangci:
    name: lint
    runs-on: [self-hosted, linux, x64, runner-1]
    steps:
      - name: Configure git for private modules
        env:
          TOKEN: ${{ secrets.GITHUB_TOKEN }}
          USER_NAME: ${{ secrets.GITHUB_TOKEN }}
        run: git config --global url."https://${USER_NAME}:${TOKEN}@github.com".insteadOf "https://github.com"
      - uses: actions/checkout@v2
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: v1.32.2

          # Optional: working directory, useful for monorepos
          # working-directory: somedir

          # Optional: golangci-lint command line arguments.
          args: --verbose

          # Optional: show only new issues if it's a pull request. The default value is `false`.
          only-new-issues: true

Steps to reproduce

act pull_request --container-architecture linux/amd64 -P runner-1=nektos/act-environments-ubuntu:18.04

act output

[Assign PR to Creator/automation                     ] 🚀  Start image=nektos/act-environments-ubuntu:18.04
[Assign PR to Creator/automation                     ]   🐳  docker pull image=nektos/act-environments-ubuntu:18.04 platform=linux/amd64 username= forcePull=false
Error: unable to determine if image already exists for image "nektos/act-environments-ubuntu:18.04" (linux/amd64): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Log
PASTE YOUR LOG HERE

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

colima uses $HOME/.colima/docker.sock

Regardless, it seems that the option --container-daemon-socket might not work?

I tried

  • --container-daemon-socket unix://$HOME/.colima/docker.sock
  • --container-daemon-socket="unix://$HOME/.colima/docker.sock"
  • --container-daemon-socket $HOME/.colima/docker.sock
  • --container-daemon-socket="$HOME/.colima/docker.sock"

but still got Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

setting DOCKER_HOST="unix://$HOME/.colima/docker.sock" did work however.

Colima v0.4.0+ uses $HOME/.colima/default/docker.sock as a new socket location. You can check the socket path by running colima status (ref. colima/FAQ.md at main · abiosoft/colima · GitHub):

> colima status
INFO[0000] colima is running
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/<user-name>/.colima/default/docker.sock

Another option to set the correct socket path programatically is to get it via docker context output. The docker context ls printouts the list of docker contexts:

> docker context ls
NAME            DESCRIPTION                               DOCKER ENDPOINT                                     KUBERNETES ENDPOINT   ORCHESTRATOR
colima          colima                                    unix:///Users/<user-name>/.colima/default/docker.sock                         
default         Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                               swarm

Then, we can get the correct path of colima context like:

> docker context inspect colima | jq -r '.[0].Endpoints.docker.Host'
unix:///Users/<user-name>/.colima/default/docker.sock

So we can export DOCKER_HOST with this command:

> export DOCKER_HOST=(docker context inspect colima | jq -r '.[0].Endpoints.docker.Host')
> printenv DOCKER_HOST
unix:///Users/<user-name>/.colima/default/docker.sock

shuuji3’s suggestion with a slight modification helps for rancher desktop as well:

export DOCKER_HOST=$(docker context inspect | jq -r '.[0].Endpoints.docker.Host')

--container-daemon-socket is for path to socket that will be mounted into containers We follow Docker connect flow by using DOCKER_HOST to find Docker Engine API compatible daemon (dockerd, podman, etc.)

This did the trick for mac users that use Docker desktop!