Skip to content

docker-container boot fails with "container conflict" for multiple simultaneous builds #1868

@HarvyNBB

Description

@HarvyNBB

Contributing guidelines

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

  • Description:
    buildkit fails with container conflict for multiple simultaneous builds

Note: I'm not sure whether this is buildx issue or buildkit issue

Expected behaviour

buildkit should work successfully for simultaneous parallel builds by auto detecting this scenario and creating unique containers for each build

Actual behaviour

buildkit fails with container conflict error

Buildx version

github.com/docker/buildx v0.10.5 86bdced

Docker info

09:17:32  Client: Docker Engine - Community
09:17:32   Version:    24.0.2
09:17:32   Context:    default
09:17:32   Debug Mode: false
09:17:32   Plugins:
09:17:32    buildx: Docker Buildx (Docker Inc.)
09:17:32      Version:  v0.10.5
09:17:32      Path:     /usr/libexec/docker/cli-plugins/docker-buildx
09:17:32    compose: Docker Compose (Docker Inc.)
09:17:32      Version:  v2.18.1
09:17:32      Path:     /usr/libexec/docker/cli-plugins/docker-compose
09:17:32  
09:17:32  Server:
09:17:32   Containers: 0
09:17:32    Running: 0
09:17:32    Paused: 0
09:17:32    Stopped: 0
09:17:32   Images: 0
09:17:32   Server Version: 24.0.2
09:17:32   Storage Driver: overlay2
09:17:32    Backing Filesystem: extfs
09:17:32    Supports d_type: true
09:17:32    Using metacopy: false
09:17:32    Native Overlay Diff: false
09:17:32    userxattr: true
09:17:32   Logging Driver: json-file
09:17:32   Cgroup Driver: systemd
09:17:32   Cgroup Version: 2
09:17:32   Plugins:
09:17:32    Volume: local
09:17:32    Network: bridge host ipvlan macvlan null overlay
09:17:32    Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
09:17:32   Swarm: inactive
09:17:32   Runtimes: io.containerd.runc.v2 runc
09:17:32   Default Runtime: runc
09:17:32   Init Binary: docker-init
09:17:32   containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
09:17:32   runc version: v1.1.7-0-g860f061
09:17:32   init version: de40ad0
09:17:32   Security Options:
09:17:32    seccomp
09:17:32     Profile: builtin
09:17:32    rootless
09:17:32    cgroupns
09:17:32   Kernel Version: 6.1.0-0.deb11.7-amd64
09:17:32   Operating System: Debian GNU/Linux 11 (bullseye)
09:17:32   OSType: linux
09:17:32   Architecture: x86_64
09:17:32   CPUs: 4
09:17:32   Total Memory: 7.466GiB
09:17:32   Name: ip-10-110-42-29
09:17:32   ID: 2f84679c-19d6-4252-ac4c-08a2f641ab6b
09:17:32   Docker Root Dir: /home/admin/.local/share/docker
09:17:32   Debug Mode: false
09:17:32   Experimental: false
09:17:32   Insecure Registries:
09:17:32    127.0.0.0/8
09:17:32   Live Restore Enabled: false
09:17:32  
09:17:32  WARNING: No cpu cfs quota support
09:17:32  WARNING: No cpu cfs period support
09:17:32  WARNING: No cpu shares support
09:17:32  WARNING: No cpuset support
09:17:32  WARNING: No io.weight support
09:17:32  WARNING: No io.weight (per device) support
09:17:32  WARNING: No io.max (rbps) support
09:17:32  WARNING: No io.max (wbps) support
09:17:32  WARNING: No io.max (riops) support
09:17:32  WARNING: No io.max (wiops) support
09:17:32  WARNING: bridge-nf-call-iptables is disabled
09:17:32  WARNING: bridge-nf-call-ip6tables is disabled

Builders list

09:17:32  + docker buildx ls
09:17:32  NAME/NODE             DRIVER/ENDPOINT                   STATUS   BUILDKIT                              PLATFORMS
09:17:32  multi-arch-builder    docker-container                                                                 
09:17:32    multi-arch-builder0 unix:///run/user/1000/docker.sock inactive                                       
09:17:32  default                                                 error                                          
09:17:32  rootless *            docker                                                                           
09:17:32    rootless            rootless                          running  v0.11.7-0.20230525183624-798ad6b0ce9f linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

Configuration

version: '3.7'

services:
 
  service_1:
    container_name: service_1-${VERSION}
    image: service_1:${VERSION}    
    build:
      context: .
      dockerfile: Dockerfile
      platforms: 
        - ${PLATFORM_1}
        - ${PLATFORM_2}
  
  service_2:
    container_name: service_2-${VERSION}
    image: service_2:${VERSION}
    build:
      context: .
      dockerfile: Dockerfile
      platforms: 
        - ${PLATFORM_1}
        - ${PLATFORM_2}

  service_3:
    container_name: service_3-${VERSION}
    image: service_3:${VERSION}
    build:
      context: .
      dockerfile: Dockerfile
    platforms: 
        - ${PLATFORM_1}
        - ${PLATFORM_2}

Build logs

docker buildx create --name test
docker buildx use --builder test
docker compose build service_1 service_2 service_3 

[arm64] #1 [internal] booting buildkit
[arm64] #1 [internal] booting buildkit
[arm64] #1 [internal] booting buildkit
[arm64] #1 pulling image moby/buildkit:buildx-stable-1
[arm64] #1 pulling image moby/buildkit:buildx-stable-1
[arm64] #1 pulling image moby/buildkit:buildx-stable-1
[arm64] #1 pulling image moby/buildkit:buildx-stable-1 0.9s done
[arm64] #1 creating container buildx_buildkit_test0 done
[arm64] #1 ERROR: Error response from daemon: Conflict. The container name "/buildx_buildkit_test0" is already in use by container "a33ad73d0d964df35acb590903e6ca174acf83bd68721a5407d104831b3b5997". You have to remove (or rename) that container to be able to reuse that name.
[arm64] ------
[arm64]  > [internal] booting buildkit:
[arm64] ------
[arm64] #1 pulling image moby/buildkit:buildx-stable-1 0.9s done
[arm64] #1 creating container buildx_buildkit_test0 0.0s done
[arm64] #1 CANCELED
[arm64] #1 pulling image moby/buildkit:buildx-stable-1 0.9s done
[arm64] #1 creating container buildx_buildkit_test0 done
[arm64] #1 CANCELED
[arm64] Error response from daemon: Conflict. The container name "/buildx_buildkit_test0" is already in use by container "a33ad73d0d964df35acb590903e6ca174acf83bd68721a5407d104831b3b5997". You have to remove (or rename) that container to be able to reuse that name.

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions