Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to the Docker daemon at unix:///var/run/docker.sock #3504

Open
JuanHurn opened this issue Oct 11, 2024 · 0 comments
Open

Cannot connect to the Docker daemon at unix:///var/run/docker.sock #3504

JuanHurn opened this issue Oct 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JuanHurn
Copy link

JuanHurn commented Oct 11, 2024

Describe the bug
I am attempting to build a custom Docker image and push it to a local repository. While I am able to successfully log in to the repository, I encounter an issue when I try to build and push the image. Specifically, I receive the following error:

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

To Reproduce
I am using this action file

name: Publish docker image

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  push_to_registry:
    name: Push Docker image to Harbor
    runs-on: self-hosted
    environment: ${{ github.ref == 'refs/heads/main' && 'DEV' || github.ref }}

    permissions:
      packages: write
      contents: read
      attestations: write
      id-token: write

    steps:
      - name: Check out the repo
        uses: actions/checkout@v4

      - name: Get short SHA
        id: get-sha
        run: |
          SHORT_SHA=$(git rev-parse --short HEAD)
          echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
      - name: Log in to Harbor
        uses: docker/login-action@v3
        with:
          registry: ${{ secrets.HARBOR_URL }}
          username: ${{ secrets.SVC_USERNAME }}
          password: ${{ secrets.SVC_PASSWORD }}

      - name: Build and push Docker image
        id: push
        uses: docker/build-push-action@v6
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: "folder1/image-name:${{ env.SHORT_SHA }}"

I have tried different versions of the build and push commands, as well as manually building the image using the run command, but all attempts yield the same result. It seems the issue persists regardless of the method I use.

GitHub Actions runtime token access controls
Docker info
  /usr/bin/docker version
  Client:
   Version:           27.1.1
   API version:       1.46
   Go version:        go1.21.12
   Git commit:        6312585
   Built:             Tue Jul 23 19:55:52 2024
   OS/Arch:           linux/amd64
   Context:           default
  Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I am using the new version of the runner: actions-runner:2.320.0

@JuanHurn JuanHurn added the bug Something isn't working label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant