The docker/setup-buildx-action is a GitHub Action used to set up Docker Buildx in your GitHub Actions workflows. Buildx is a Docker CLI plugin that extends the docker build command with support for multi-platform builds, caching, and more advanced features.
If you’re seeing an error with docker/setup-buildx-action, let’s break it down in two parts:
๐ Common Errors
1. Error: buildx is not available
Cause: Docker Buildx is not installed or not correctly set up.
Fix: Ensure the action is used with
install: trueanduse: true:
2. failed to create LLB definition or no matching manifest for
Cause: Trying to build a multi-platform image without proper setup or base image doesn’t support the architecture.
Fix: Add
--platform, and ensure you’re using images that support those architectures.
3. Cannot connect to the Docker daemon
Cause: GitHub Actions runner doesnโt have Docker properly set up.
Fix: Make sure you’re using a Linux runner (
ubuntu-latest) and Docker is installed.
Also Read : Fixed : Planet Zoo Error Communicating with Franchise Server
๐ง Recommended Setup Example
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
– uses: actions/checkout@v4
– name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
use: true
driver: docker-container
driver-opts: network=host
– name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
– name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
– name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: youruser/yourimage:latest
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
๐ Key Options for docker/setup-buildx-action
| Option | Description |
|---|---|
version | Specific Buildx version to use (e.g. v0.11.2 or latest) |
driver | Builder driver type (docker or docker-container) |
driver-opts | Extra options for the driver (like network=host) |
buildkitd-flags | Flags passed to the buildkitd process (e.g. --debug) |
install | If true, sets buildx as the default builder (default: false) |
use | If true, sets up the created builder as the current one (default: false) |
Be the first to comment