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

Action uselessly requires a running Docker daemon with the Kubernetes buildx driver #593

Closed
antoinedeschenes opened this issue Apr 11, 2022 · 3 comments · Fixed by #601
Closed
Labels
kind/enhancement New feature or request

Comments

@antoinedeschenes
Copy link

Troubleshooting

Same as buildx action issue docker/setup-buildx-action#135

Behaviour

Steps to reproduce this issue

  1. Setup a self-hoster runner without any docker daemon.
  2. Setup a docker buildx runner using the kubernetes driver:
    $ docker buildx create --append --driver=kubernetes --platform linux/amd64 --driver-opt 'namespace=mynamespace,requests.cpu=1,requests.memory=1Gi,limits.cpu=1,limits.memory=2Gi,nodeselector=kubernetes.io/arch=amd64,rootless=true'

Expected behaviour

build-push-action should build a docker image using the kubernetes driver.

Actual behaviour

Action fails during the Docker info step, as it calls docker version and docker info, both of which expect a running Docker daemon.
https://github.com/docker/setup-buildx-action/blob/20111c644724909db5e5afbf25d7de40ddf74f0b/src/main.ts#L13-L16

Configuration

jobs:
  build-push:
    runs-on: self-hosted
    steps:
      - id: build_info
        name: build info
        run: echo ::set-output name=tags::ghcr.io/${{ github.repository }}:latest
      - name: setup buildx
        run: |
          docker buildx create --append --driver=kubernetes --platform linux/amd64 --driver-opt 'namespace=mynamespace,requests.cpu=1,requests.memory=1Gi,limits.cpu=1,limits.memory=2Gi,nodeselector=kubernetes.io/arch=amd64,rootless=true'
      - name: build and push
        uses: docker/build-push-action@v2
        with:
          tags: ${{ steps.build_info.outputs.tags }}
          platforms: linux/amd64
          push: false

Logs

Example of Docker info step:

$ docker version
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Client:
 Cloud integration: v1.0.22
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:08:43 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
@crazy-max crazy-max added the kind/enhancement New feature or request label Apr 27, 2022
@remidebette
Copy link

Hi,
We have a similar warning for a remote driver with buildkit

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        id: buildx
        with:
          driver: remote
          endpoint: tcp://buildkit-buildkit-service.buildkit:1234

In the post job cleanup we have a warning:

Post job cleanup.
(...)
exporting build record to /__w/_temp/docker-actions-toolkit-cMSHLL/export
  /usr/bin/mkfifo /__w/_temp/docker-actions-toolkit-cMSHLL/buildx-in-kmWhDF.fifo
  /usr/bin/mkfifo /__w/_temp/docker-actions-toolkit-cMSHLL/buildx-out-jLcNG1.fifo
  docker buildx --builder builder-cc2bbcca-4c19-45d8-b14f-b1455e177a1d dial-stdio
  docker run --rm -i -v /home/runner/.docker/buildx/refs:/buildx-refs -v /__w/_temp/docker-actions-toolkit-cMSHLL/export:/out docker.io/dockereng/export-build:latest --ref-state-dir=/buildx-refs --node=builder-cc2bbcca-4c19-45d8-b14f-b1455e177a1d/builder-cc2bbcca-4c19-45d8-b14f-b1455e177a1d0 --ref=k5l9[6](https://github.com/instadeepai/aichor-product/actions/runs/9976293593/job/27568141615#step:20:7)3t3kpdpqa6qkz9ttqo76 --uid=1001 --gid=1001
  docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
  See 'docker run --help'.
  Process "docker run" exited with code 125
  Warning: Process "docker run" closed with code 125

Can the same fix done for the kubernetes driver be done also for the remote driver?

@crazy-max
Copy link
Member

@remidebette Ah good catch, can you open a new issue for this please?

@remidebette
Copy link

Done ☝🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants