-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Description
When running the command $ docker compose -p <project_name> down <list_services> , it removes all services created with the same <project_name> when it does not find any service that was informed in <list_services>.
Steps To Reproduce
Assuming I have two docker-compose.yml files in different directories:
/app1/docker-compose.yml with services: app1, nginx_app1:
services:
app1:
image: app1
expose:
- "80"
nginx_app1:
image: nginx
ports:
- "8080:8080"/app2/docker-compose.yml with services: app2, nginx_app2:
services:
app2:
image: app2
expose:
- "80"
nginx_app2:
image: nginx
ports:
- "8081:8081"And I performed the up of them separately but using the same project_name:
$ cd /app1
$ docker compose -p myproject up -d app1 nginx_app1$ cd /app2
$ docker compose -p myproject up -d app2 nginx_app2After that, if I run:
$ docker compose -p myproject psI will see all 4 services running.
And if I want to stop only the services of app1, I can naturally do:
$ cd /app1
$ docker compose -p myproject down app1 nginx_app1However, this works at first because there were services running with the names app1 and nginx_app1, but if I run this same command a second time, docker ends the services of app2. Why? Since I explicitly informed the services of app1 in the command?
I only noticed that this happens when the command no longer finds any services related to app1 running. But in this case, the expected behavior would be for docker to inform that it did not find any services with the names informed for them to be stopped.
Compose Version
Docker Compose version v2.29.7
Docker Environment
Client: Docker Engine - Community
Version: 25.0.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.29.7
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 12
Running: 12
Paused: 0
Stopped: 0
Images: 7
Server Version: 26.1.4
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
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-1012-oracle
Operating System: Ubuntu 22.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.753GiB
Name: testesdevjava
ID: 2475a2ee-09b7-4265-b286-a1fc57124493
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
164.152.40.81:5000
localhost:5000
127.0.0.0/8
Live Restore Enabled: false
Anything else?
No response