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?