[GH-ISSUE #2095] act fails where GitHub CI succeeds #1003

Closed
opened 2026-03-01 21:48:07 +03:00 by kerem · 5 comments
Owner

Originally created by @dabrahams on GitHub (Nov 17, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/2095

Bug report info

% act --bug-report
act version:            0.2.54
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	$HOME/.docker/run/docker.sock
Config files:
	/Users/dave/.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.21.4
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.54
		DefaultGODEBUG:       panicnil=1
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               arm64
		GOOS:                 darwin

Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Command used with act

act --container-architecture linux/amd64 -v

Describe issue

Note that Docker IS in fact running

act fails on my local machine but the workflow succeeds in Github Linux CI

See attached act.log

https://github.com/dabrahams/SPMBuildToolSupport/actions/runs/6901849884

Workflow content

---
name: Build and test

"on":
  push:
    branches: [main, rewrite]
    paths-ignore:
      - "Docs/**"
      - "**.md"
      - "README.md"
      - "LICENSE"
      - ".gitignore"
  pull_request:
    branches: ["**"]
    paths-ignore:
      - "Docs/**"
      - "**.md"
      - "README.md"
      - "LICENSE"
      - ".gitignore"

jobs:

  devcontainer:
    name: "Devcontainer: ${{ matrix.os }}/${{ matrix.configuration }}"
    strategy:
      matrix:
        os: [ubuntu-latest]
        configuration: [debug]

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3

      - name: Build and Test
        uses: devcontainers/ci@v0.3
        with:
          runCmd: swift test -c ${{ matrix.configuration }}

  native:
    name: "Native: ${{ matrix.os }}/${{ matrix.configuration }}"
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]

        configuration: [debug]

        include:
          # Default values to add
          - shell: 'bash -eo pipefail {0}'

          # Overrides for the defaults
          - shell: pwsh
            os: windows-latest

    runs-on: ${{ matrix.os }}

    defaults:
      run:
        shell: ${{ matrix.shell }}

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup Swift (Unices)
        if: ${{ matrix.os != 'windows-latest' }}
        uses: 'swift-actions/setup-swift@v1'
        with:
          version: 5.8

      - name: Setup Swift (Windows)
        if: ${{ matrix.os == 'windows-latest' }}
        uses: 'compnerd/gha-setup-swift@main'
        with:
          github-repo: thebrowsercompany/swift-build
          release-asset-name: installer-amd64.exe
          release-tag-name: 20231010.3
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and Test (${{ matrix.configuration }})
        run: swift test -c ${{ matrix.configuration }}

Relevant log output

(too long; please see attached file)

Additional information

No response

Originally created by @dabrahams on GitHub (Nov 17, 2023). Original GitHub issue: https://github.com/nektos/act/issues/2095 ### Bug report info ```plain text % act --bug-report act version: 0.2.54 GOOS: darwin GOARCH: arm64 NumCPU: 10 Docker host: DOCKER_HOST environment variable is not set Sockets found: $HOME/.docker/run/docker.sock Config files: /Users/dave/.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.21.4 Module path: command-line-arguments Main version: Main path: Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -X main.version=0.2.54 DefaultGODEBUG: panicnil=1 CGO_ENABLED: 1 CGO_CFLAGS: CGO_CPPFLAGS: CGO_CXXFLAGS: CGO_LDFLAGS: GOARCH: arm64 GOOS: darwin Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ``` ### Command used with act ```sh act --container-architecture linux/amd64 -v ``` ### Describe issue Note that **Docker IS in fact running** act fails on my local machine but the workflow succeeds in Github Linux CI See attached [act.log](https://github.com/nektos/act/files/13389841/act.log) ### Link to GitHub repository https://github.com/dabrahams/SPMBuildToolSupport/actions/runs/6901849884 ### Workflow content ```yml --- name: Build and test "on": push: branches: [main, rewrite] paths-ignore: - "Docs/**" - "**.md" - "README.md" - "LICENSE" - ".gitignore" pull_request: branches: ["**"] paths-ignore: - "Docs/**" - "**.md" - "README.md" - "LICENSE" - ".gitignore" jobs: devcontainer: name: "Devcontainer: ${{ matrix.os }}/${{ matrix.configuration }}" strategy: matrix: os: [ubuntu-latest] configuration: [debug] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - name: Build and Test uses: devcontainers/ci@v0.3 with: runCmd: swift test -c ${{ matrix.configuration }} native: name: "Native: ${{ matrix.os }}/${{ matrix.configuration }}" strategy: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] configuration: [debug] include: # Default values to add - shell: 'bash -eo pipefail {0}' # Overrides for the defaults - shell: pwsh os: windows-latest runs-on: ${{ matrix.os }} defaults: run: shell: ${{ matrix.shell }} steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Swift (Unices) if: ${{ matrix.os != 'windows-latest' }} uses: 'swift-actions/setup-swift@v1' with: version: 5.8 - name: Setup Swift (Windows) if: ${{ matrix.os == 'windows-latest' }} uses: 'compnerd/gha-setup-swift@main' with: github-repo: thebrowsercompany/swift-build release-asset-name: installer-amd64.exe release-tag-name: 20231010.3 github-token: ${{ secrets.GITHUB_TOKEN }} - name: Build and Test (${{ matrix.configuration }}) run: swift test -c ${{ matrix.configuration }} ``` ### Relevant log output ```sh (too long; please see attached file) ``` ### Additional information _No response_
kerem 2026-03-01 21:48:07 +03:00
Author
Owner

@SyntaxSugarNet commented on GitHub (Mar 22, 2024):

Facing the same issue using act and devcontainers/ci.

The problem is that the mounted workspace in the devcontainers/ci docker container is from the host file system.

act is creating its own docker container with the workspace copied into its container's file system. devcontainers/ci docker container is not created inside act's container (no docker-in-docker), but besides it. Therefore devcontainers/ci's workspace mount is not pointing to act's workspace copy, but to the original workspace on the host file system.

This is why the devcontainer cannot start. Path /var/run/act/workflow/ exists in act's container but not on your host system:

| [2023-11-17T09:14:55.111Z] Start: Run: docker run 
...
--mount type=bind,src=/var/run/act/workflow/outputcmd.txt,dst=/mnt/github/output
...
| [2023-11-17T09:14:55.386Z] docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/run/act/workflow/outputcmd.txt.

This can be worked around by creating the files under /var/run/act/workflow/ on the host filesystem, so the devcontainer can start, BUT as the devcontainers/ci step will work on a different file system from all the other steps in the job, running it with act will be possibly pointless.

Not sure how act should handle these kind of scenarios, but maybe if instead of copying the workspace into its container it could create a temporary copy of the workspace and the necessary files (like /var/run/act/workflow/) on the host file system. Then could bind mount this copy into all of the containers created for the given job run and all the steps of the job would work on the same copied workspace on the host file system.

<!-- gh-comment-id:2015817810 --> @SyntaxSugarNet commented on GitHub (Mar 22, 2024): Facing the same issue using `act` and `devcontainers/ci`. The problem is that the **mounted workspace** in the `devcontainers/ci` docker container is **from the host file system**. `act` is creating its own docker container with the workspace copied into its container's file system. `devcontainers/ci` docker container is not created inside `act`'s container (no docker-in-docker), but besides it. Therefore `devcontainers/ci`'s workspace mount is not pointing to `act`'s workspace copy, but to the original workspace on the host file system. This is why the devcontainer cannot start. Path `/var/run/act/workflow/` exists in `act`'s container but not on your host system: ```bash | [2023-11-17T09:14:55.111Z] Start: Run: docker run ... --mount type=bind,src=/var/run/act/workflow/outputcmd.txt,dst=/mnt/github/output ... | [2023-11-17T09:14:55.386Z] docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/run/act/workflow/outputcmd.txt. ``` This can be worked around by creating the files under `/var/run/act/workflow/` on the host filesystem, so the devcontainer can start, BUT as the `devcontainers/ci` step will work on a different file system from all the other steps in the job, running it with `act` will be possibly pointless. _Not sure how `act` should handle these kind of scenarios, but maybe if instead of copying the workspace into its container it could create a temporary copy of the workspace and the necessary files (like `/var/run/act/workflow/`) on the host file system. Then could bind mount this copy into all of the containers created for the given job run and all the steps of the job would work on the same copied workspace on the host file system._
Author
Owner

@gund commented on GitHub (Jun 18, 2024):

I've hit the same issue as @SyntaxSugarNet while trying to run devcontainers/ci action with act on WSL:

| [2024-06-18T16:01:17.833Z] docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/run/act/workflow/outputcmd.txt.
<!-- gh-comment-id:2176481104 --> @gund commented on GitHub (Jun 18, 2024): I've hit the same issue as @SyntaxSugarNet while trying to run `devcontainers/ci` action with `act` on WSL: ```zsh | [2024-06-18T16:01:17.833Z] docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/run/act/workflow/outputcmd.txt. ```
Author
Owner

@zanettea commented on GitHub (Aug 14, 2024):

A workaround I found is to use custom a image that adds the dockerd daemon and then adding a step before devcontainer/ci to start docker-in-docker:

[...]

      - name: optionally start DinD for act (local testing)
        if: env.ACT
        run: |
          dockerd -H unix:///var/run/dind.sock & sleep 5;
          echo "DOCKER_HOST=unix:///var/run/dind.sock" >>${GITHUB_ENV}

[....]

The command line: act -s GITHUB_TOKEN="$(gh auth token)" --container-options --privileged -P ubuntu-latest=ghcr.io/corvina-r-d/ubuntu:act-22.04

However it would be nice if docker-in-docker were a native options of act (act --dind ... )

<!-- gh-comment-id:2289617577 --> @zanettea commented on GitHub (Aug 14, 2024): A workaround I found is to use custom a image that adds the dockerd daemon and then adding a step before devcontainer/ci to start docker-in-docker: ``` [...] - name: optionally start DinD for act (local testing) if: env.ACT run: | dockerd -H unix:///var/run/dind.sock & sleep 5; echo "DOCKER_HOST=unix:///var/run/dind.sock" >>${GITHUB_ENV} [....] ``` The command line: ` act -s GITHUB_TOKEN="$(gh auth token)" --container-options --privileged -P ubuntu-latest=ghcr.io/corvina-r-d/ubuntu:act-22.04 ` However it would be nice if docker-in-docker were a native options of act (`act --dind` ... )
Author
Owner

@github-actions[bot] commented on GitHub (Feb 11, 2025):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2649539168 --> @github-actions[bot] commented on GitHub (Feb 11, 2025): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@stevejr commented on GitHub (Feb 27, 2025):

This issue is still present. Is it possible to get an update on an official fix?

<!-- gh-comment-id:2688056184 --> @stevejr commented on GitHub (Feb 27, 2025): This issue is still present. Is it possible to get an update on an official fix?
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#1003
No description provided.