Description
Description
Docker-CE 28.2.1 and Compose v2.36.2, with a compose stack A that has its network used by another stack B. When attempting a docker compose down
, it first correctly reports the network is in use, then tries to remove it anyway.
At that point even a docker compose up -d
fails, and the only way to recover is to stop stack B that uses stack A's network, start stack A again, then start stack B that relied on its network.
Example logs:
[+] Running 5/5
✔ Container traefik-node-exporter-1 Removed 0.0s
✔ Container traefik-promtail-1 Removed 10.4s
✔ Container traefik-cadvisor-1 Removed 0.0s
✔ Container traefik-cmf_docker_metrics-1 Removed 0.4s
! Network traefik_default Resource is still in use 0.0s
[+] Running 1/1
✔ Network traefik_default Removed 0.0s
Error response from daemon: error while removing network: network traefik_default has active endpoints (name:"eth-main-ethereum-metrics-exporter-1" id:"a5482a754fc3", name:"eth-main-execution-1" id:"1653f67ad42c", name:"eth-main-mev-boost-1" id:"96ab09e4a0cd", name:"eth-main-consensus-1" id:"7de7a7846c77")
Steps To Reproduce
Create a compose stack A with any service, let it create its default network
Create a compose stack B with any service, point its default network to that of compose stack A:
networks:
default:
name: stacka_default
external: true
Run docker compose down
on compose stack A and observe. It should identify the network as still in use and not try to remove it, and only stop and remove services.
"This used to work" up until Docker-CE 28.2.1, likely broke with 28.2.0 and Compose v2.36.2
The last combo where I have it working as expected is Docker Compose version v2.35.1
and Docker version 28.1.1, build 4eba377
Compose Version
Docker Compose version v2.36.2
Docker Environment
Client: Docker Engine - Community
Version: 28.2.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.24.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.36.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 11
Running: 11
Paused: 0
Stopped: 0
Images: 14
Server Version: 28.2.1
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: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.1.0-35-amd64
Operating System: Debian GNU/Linux 12 (bookworm)
OSType: linux
Architecture: x86_64
CPUs: 48
Total Memory: 94.01GiB
Name: olpr-eueri-bci-prod-glxy-eth-mainnet-fn-bt-0
ID: 7145c007-fa1c-472e-ad4b-55ef777f5498
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Anything else?
Example logs of correct behavior on Compose v2.35.1 and Docker 28.1.1:
debian@eth-main-a:~/traefik$ docker compose down
[+] Running 3/3
✔ Container traefik-cf-ddns-1 Removed 0.3s
✔ Container traefik-traefik-1 Removed 10.8s
! Network traefik_default Resource is still in use
Compose does not try to remove the network that is still in use.