
Eu tenho o seguinte 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
Então eu uso o seguinte script de shell para construir ...
#! /bin/bash
docker-compose build
docker-compose up -d
Mas quando executo o shell script ele tenta criar um moby/buildkit:buildx-stable-1
contêiner. Este contêiner falha e acabo com o seguinte erro na minha compilação...
=> 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.
Por que isso está acontecendo e como posso evitar esse conflito?
Responder1
Este contêiner foi aparentemente criado pelo Docker BuildKit (o novo docker build
substituto), usando esta imagem:
https://hub.docker.com/r/moby/buildkit
Para desabilitar este contêiner você pode definir a instância do construtor como padrão com:
docker buildx use default