[GH-ISSUE #1051] Issue: cannot connect to Docker daemon #612

Closed
opened 2026-03-01 21:44:56 +03:00 by kerem · 18 comments
Owner

Originally created by @adzimzf on GitHub (Mar 16, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1051

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
Originally created by @adzimzf on GitHub (Mar 16, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1051 <!-- - Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases) - Search the existing issues. - Refer to [README](https://github.com/nektos/act/blob/master/README.md). --> ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - 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 <!-- - Describe how whole process should go and finish --> the act can run ## Actual behaviour <!-- - Describe the issue --> 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 ```name: golangci-lint 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 ``` </details> ## 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? ``` <details> <summary>Log</summary> ```none PASTE YOUR LOG HERE ``` </details>
kerem 2026-03-01 21:44:56 +03:00
Author
Owner

@catthehacker commented on GitHub (Mar 16, 2022):

Do you have DOCKER_HOST environment variable set? You can't connect to Docker on macOS via unix socket because it's running in virtual machine.

<!-- gh-comment-id:1069459037 --> @catthehacker commented on GitHub (Mar 16, 2022): Do you have `DOCKER_HOST` environment variable set? You can't connect to Docker on macOS via unix socket because it's running in virtual machine.
Author
Owner

@adzimzf commented on GitHub (Mar 16, 2022):

I check it, there's no env variable for DOCKER_HOST

<!-- gh-comment-id:1069465477 --> @adzimzf commented on GitHub (Mar 16, 2022): I check it, there's no env variable for `DOCKER_HOST`
Author
Owner

@catthehacker commented on GitHub (Mar 16, 2022):

It seems Docker for Mac supports unix:///var/run/docker.sock so I have no idea what's wrong

<!-- gh-comment-id:1069506098 --> @catthehacker commented on GitHub (Mar 16, 2022): It seems [Docker for Mac supports `unix:///var/run/docker.sock`](https://docs.docker.com/desktop/faqs/#how-do-i-connect-to-the-remote-docker-engine-api) so I have no idea what's wrong
Author
Owner

@catthehacker commented on GitHub (Mar 16, 2022):

You could check if /var/run actually contains docker.sock

<!-- gh-comment-id:1069507066 --> @catthehacker commented on GitHub (Mar 16, 2022): You could check if `/var/run` actually contains `docker.sock`
Author
Owner

@adzimzf commented on GitHub (Mar 17, 2022):

I try to search there's no docker.sock under /var/run

is this due to I use colima as the docker server?

<!-- gh-comment-id:1070215957 --> @adzimzf commented on GitHub (Mar 17, 2022): I try to search there's no `docker.sock` under `/var/run` is this due to I use `colima` as the docker server?
Author
Owner

@catthehacker commented on GitHub (Mar 17, 2022):

is this due to I use colima as the docker server?

Probably, I don't have a mac so I can't check how it works. It's better if you ask in https://github.com/abiosoft/colima how to get /var/run/docker.sock unix socket or some other way to connect to it.

<!-- gh-comment-id:1070441121 --> @catthehacker commented on GitHub (Mar 17, 2022): > is this due to I use `colima` as the docker server? Probably, I don't have a mac so I can't check how it works. It's better if you ask in https://github.com/abiosoft/colima how to get `/var/run/docker.sock` unix socket or some other way to connect to it.
Author
Owner

@aldafu commented on GitHub (Mar 17, 2022):

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.

<!-- gh-comment-id:1070599087 --> @aldafu commented on GitHub (Mar 17, 2022): `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.
Author
Owner

@catthehacker commented on GitHub (Mar 17, 2022):

--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.)

<!-- gh-comment-id:1070651005 --> @catthehacker commented on GitHub (Mar 17, 2022): `--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.)
Author
Owner

@portovep commented on GitHub (Mar 19, 2022):

Thanks @catthehacker. I am using Colima and that worked for me.

<!-- gh-comment-id:1072974130 --> @portovep commented on GitHub (Mar 19, 2022): Thanks @catthehacker. I am using Colima and that worked for me.
Author
Owner

@adzimzf commented on GitHub (Mar 21, 2022):

thanks, that works for me too.

so the problem is why the DOCKER_HOST is not set by default, am I correct?

<!-- gh-comment-id:1073934847 --> @adzimzf commented on GitHub (Mar 21, 2022): thanks, that works for me too. so the problem is why the `DOCKER_HOST` is not set by default, am I correct?
Author
Owner

@catthehacker commented on GitHub (Mar 21, 2022):

Yes

<!-- gh-comment-id:1074051808 --> @catthehacker commented on GitHub (Mar 21, 2022): Yes
Author
Owner

@roseline124 commented on GitHub (Oct 12, 2022):

This saved my time. Thank you!

<!-- gh-comment-id:1275843460 --> @roseline124 commented on GitHub (Oct 12, 2022): This saved my time. Thank you!
Author
Owner

@shuuji3 commented on GitHub (Dec 7, 2022):

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
<!-- gh-comment-id:1340342410 --> @shuuji3 commented on GitHub (Dec 7, 2022): 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](https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#docker-socket-location)): ```shell > 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: ```shell > 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: ```shell > 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: ```shell > export DOCKER_HOST=(docker context inspect colima | jq -r '.[0].Endpoints.docker.Host') > printenv DOCKER_HOST unix:///Users/<user-name>/.colima/default/docker.sock ```
Author
Owner

@zoedsoupe commented on GitHub (Apr 28, 2023):

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

<!-- gh-comment-id:1528079481 --> @zoedsoupe commented on GitHub (Apr 28, 2023): This did the trick for mac users that use Docker desktop!
Author
Owner

@cyberw commented on GitHub (Sep 24, 2023):

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')

<!-- gh-comment-id:1732542268 --> @cyberw commented on GitHub (Sep 24, 2023): 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')`
Author
Owner

@nabilfreeman commented on GitHub (Nov 13, 2023):

For me, running Docker Desktop on MacOS Ventura ARM, my socket path was: unix:///Users/myusername/.docker/run/docker.sock

To be clear, the /Users/myusername directory is equivalent to ~.

So I think this fix is necessary for regular Docker users as well.

<!-- gh-comment-id:1809077030 --> @nabilfreeman commented on GitHub (Nov 13, 2023): For me, running Docker Desktop on MacOS Ventura ARM, my socket path was: `unix:///Users/myusername/.docker/run/docker.sock` To be clear, the `/Users/myusername` directory is equivalent to `~`. So I think this fix is necessary for regular Docker users as well.
Author
Owner

@ovnicraft commented on GitHub (Dec 5, 2023):

it could solved executing act, e.g with push:

DOCKER_HOST=unix:///Users/<USER>/.colima/default/docker.sock act push --container-architecture linux/arm64

<!-- gh-comment-id:1841541029 --> @ovnicraft commented on GitHub (Dec 5, 2023): it could solved executing `act`, e.g with `push`: `DOCKER_HOST=unix:///Users/<USER>/.colima/default/docker.sock act push --container-architecture linux/arm64`
Author
Owner

@mahiki commented on GitHub (Dec 12, 2023):

for what its worth on macos with Rancher Desktop I was able to eliminate the error:

act --container-architecture linux/amd64 -l
# ERRO[0000] daemon Docker Engine socket not found and containerDaemonSocket option was not set

with

export DOCKER_HOST=$HOME/.rd/docker.sock
<!-- gh-comment-id:1851380969 --> @mahiki commented on GitHub (Dec 12, 2023): for what its worth on macos with Rancher Desktop I was able to eliminate the error: ```sh act --container-architecture linux/amd64 -l # ERRO[0000] daemon Docker Engine socket not found and containerDaemonSocket option was not set ``` with ```sh export DOCKER_HOST=$HOME/.rd/docker.sock ```
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#612
No description provided.