3

I have the following docker-compose...

version: "3.8"
services:
  proxy:
    container_name: proxy
    extra_hosts:
      - "host.docker.internal:host-gateway"
    build:
      context: proxy
      dockerfile: Dockerfile
    volumes:
      - ./proxy/certificate:/usr/cert
    ports:
      - "443:443"
  ui:
    container_name: ui
    restart: always
    build:
      context: frontend
    ports:
      - "80:80"
  backend:
    container_name: backend
    restart: always
    build:
      context: backend
    ports:
      - "8000:8000"
    environment:
      - API_KEY
      - GOLD_TOKEN

Then I use the following shell script to build...

#! /bin/bash
docker-compose build
docker-compose up -d

But when I run the shell script it tries to create a moby/buildkit:buildx-stable-1 container. This container fails and I end up with the following error in my build...

 => ERROR [internal] booting buildkit                                                                                                                                  0.9s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                     0.8s
 => => creating container buildx_buildkit_gallant_newton0                                                                                                              0.1s
[+] Building 0.9s (1/1) FINISHED                                                                                                                                            
 => CANCELED [internal] booting buildkit                                                                                                                               0.9s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                     0.8s
 => => creating container buildx_buildkit_gallant_newton0  
Error response from daemon: Conflict. The container name "/buildx_buildkit_gallant_newton0" is already in use by container "8b56bc95c1e26b736d0f297236adce9766f1363b1f94b35fcbc29ac96b4b61d3". You have to remove (or rename) that container to be able to reuse that name.

Why is this happening and how do I prevent this conflict?

Jackie
  • 171
  • 9
  • I got this for the first time immediately after upgrading Docker Desktop (on Windows) from `4.11.1` to `4.18.0`. On `4.11.1` my `docker compose up` command on my `docker-compose.yaml` _did_ work, so there's definitely a regression – JBSnorro Apr 11 '23 at 13:13

1 Answers1

0

This container is apparently created by Docker BuildKit (the new docker build replacement), using this image: https://hub.docker.com/r/moby/buildkit

To disable this container you can set the builder instance to default with:

docker buildx use default

mirekphd
  • 111
  • 4