[0.13+] Creating a `docker context` automatically creates an unwanted `docker buildx` instance
VictorRos opened this issue · comments
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
Hello everyone!
I didn't find any issue about docker context
or docker buildx
creation issue since 0.13
similar to what I got.
Since 0.13
, I cannot create a multi-arch
buildx instance anymore if I create a docker context also named multi-arch
.
It seems that it automatically creates an "unwanted" buildx instance named multi-arch
when docker context multi-arch
is created.
I didn't have this behavior in 0.12
and didn't notice a clear change of that in 0.13
release note.
I shared my local information as I also encountered this problem when I recently update Rancher Desktop on my local machine because Rancher Desktop upgrades buildx to 0.13.0
.
I first detected this problem in our pipeline agents.
We create an image where we install Docker and create a multi-arch
context and buildx instance to be able to build AMD64 and ARM64 images.
Since this problem occurred, our team cannot update the image used by our pipeline agents.
Error occurred when docker context is created and the command to create the docker buildx instance is run.
It tell us that the instance already exists (cf. Actual behaviour)
ERROR: instance name "multi-arch" already exists as context builder
Expected behaviour
docker context create \
--description "Multi-architecture context (AMD64/ARM64)" \
--docker "host=unix:///run/user/$(id -u)/docker.sock" \
multi-arch
# Successful output
multi-arch
Successfully created context "multi-arch"
docker buildx create \
--bootstrap \
--driver docker-container \
--name multi-arch \
--node multi-arch \
--platform linux/amd64,linux/arm64 \
--use \
multi-arch
# Successful output
multi-arch
Actual behaviour
docker context create \
--description "Multi-architecture context (AMD64/ARM64)" \
--docker "host=unix:///run/user/$(id -u)/docker.sock" \
multi-arch
# Successful output
multi-arch
Successfully created context "multi-arch"
docker buildx create \
--bootstrap \
--driver docker-container \
--name multi-arch \
--node multi-arch \
--platform linux/amd64,linux/arm64 \
--use \
multi-arch
# Unsuccessful output
ERROR: instance name "multi-arch" already exists as context builder
Buildx version
github.com/docker/buildx v0.13.0 0de5f1c
Docker info
Client:
Version: 25.0.4-rd
Context: rancher-desktop
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.13.0
Path: /Users/ros/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.7
Path: /Users/ros/.docker/cli-plugins/docker-compose
Server:
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 47
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4e1fe7492b9df85914c389d1f15a3ceedbb280ac
runc version: 18a0cb0f32bcac2ecc9a10f327d282759c144dab
init version:
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.14-0-virt
Operating System: Alpine Linux v3.19
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 5.787GiB
Name: lima-rancher-desktop
ID: 90310736-7374-4a85-ba14-1699fce374d8
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
multi-arch docker
\_ multi-arch \_ multi-arch running v0.11.7+d3e6c1360f6e linux/arm64
rancher-desktop* docker
\_ rancher-desktop \_ rancher-desktop running v0.11.7+d3e6c1360f6e linux/arm64
default error
# Important Note: This output is produced just after I run "docker context create" command
Configuration
I'm not even at the Dockerfile stage yet 😂
Build logs
No response
Additional info
No response
All docker contexts always come with a builder instance to use the buildkit that is embedded in Docker daemon. This has been like this from the beginning of buildx creation. When you run docker build
that redirects to docker buildx build
of the active Docker context's builder.
What changed in v0.13 is that we now have stricter validation for creating builders when one with same name already exists or appending nodes to builders when no name existed. This is to avoid errors with one builder accidentally shadowing another, leading to unexpected behavior.
Thank you for the explanation.
What we were doing was not correct.
From what I understood, we only need to create the buildx instance without having to create a dedicated context.
It should be sufficient to configure the multi-arch
buildx instance without any errors.
Something like that:
docker buildx create \
--bootstrap \
--driver docker-container \
--name multi-arch \
--node multi-arch \
--platform linux/amd64,linux/arm64 \
--use
OK to close this @VictorRos?