actions-runner-controller icon indicating copy to clipboard operation
actions-runner-controller copied to clipboard

Build `docker buildx` into runners

Open jwhitaker-swiftnav opened this issue 1 year ago • 7 comments

What would you like added?

Add the docker buildx plugin to the default runners

Why is this needed?

I'm aware of and sympathetic to the desire to keep the runners slimmer than the github hosted runners, but could a special case be made for docker buildx?

  • it's a plugin for docker with heavy use that is present in hosted runners
  • a similar plugin, compose, is installed into the runners
  • building containers is a hugely important use-case for ARC runners, and the buildx action sometimes breaks/behaves differently to hosted runners already, so having this built-in + tested in CI would be highly appreciated.
  • buildx is installed by default in almost all distributions of docker, having it missing is likely to cause more issues in the future, esp as docker moves towards using it by default.

I wouldn't ask this for any other tool, promise!

Happy to contribute a PR if this is acceptable but wanted to check your amenability first. Thanks for maintaining this system!

jwhitaker-swiftnav avatar May 09 '23 01:05 jwhitaker-swiftnav

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.

github-actions[bot] avatar May 09 '23 01:05 github-actions[bot]

Any updates on this one? I wouldn't like this to go stale if that's possible, this would be great to have as we could steps like this for our builds; which really makes things easier.

  - name: Build and push Docker image # Can't use this step because we need buildx.
        uses: docker/build-push-action@v3
        with:
          context: .
          tags: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
          file: Dockerfile  # Your Dockerfile name
          push: true
          ````

pof-jhansilva avatar Nov 05 '23 18:11 pof-jhansilva

Hello @pof-jhansilva You can try running workflow like this:

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v3
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
    - name: Build and push Docker image
      uses: docker/build-push-action@v3
      with:
        context: .
        tags: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
        file: Dockerfile  # Your Dockerfile name
        push: true

Vladyslav-Miletskyi avatar Dec 20 '23 16:12 Vladyslav-Miletskyi

any update on this? Buildkit is enabled by default in docker desktop. So not having buildkit in this image is painful. Dockerfiles which use buildx features cannot even be built.

example: any dockerfile with COPY --chmod=

ctriley avatar Feb 23 '24 17:02 ctriley

I ended up needing compose when using ARC + DinD runners. Hacky solution:

FROM ghcr.io/actions/actions-runner:latest
USER 0
RUN apt-get update && apt-get install -y curl
RUN curl -L https://github.com/docker/compose/releases/download/v2.24.6/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
RUN docker-compose version    #Verify no errors post-installation
USER runner

Build the image and retag prior to deploying ARC: docker build -t actions-runner:compose .

Edit - Made a repo.

jrbe228 avatar Mar 03 '24 18:03 jrbe228

Agree, it would be good to get docker-compose in the base image here as it's so commonly used.

ohookins avatar Mar 06 '24 00:03 ohookins

Upgrading the docker version to 25.x will solve this issue.

dverbeek84 avatar Apr 16 '24 11:04 dverbeek84