Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] docker compose wait waits for ALL containers, not just the first #12063

Closed
Raphtor opened this issue Aug 16, 2024 · 1 comment
Closed

Comments

@Raphtor
Copy link

Raphtor commented Aug 16, 2024

Description

In the documentation, it is said that docker compose wait SERVICE [SERVICE...] waits for the first service to exit. However, it seems to wait for all the listed services to exit.

Steps To Reproduce

  1. With the compose file:
services:
  service1:
    image: ubuntu:latest
    command: tail -f /dev/null
  service2:
    image: ubuntu:latest
    command: tail -f /dev/null
  1. Run docker compose up -d
  2. Run docker compose wait service1 service2
  3. In another terminal, show the running containers docker ps:
CONTAINER ID   IMAGE           COMMAND               CREATED          STATUS         PORTS     NAMES
7d71dc7baa3a   ubuntu:latest   "tail -f /dev/null"   14 seconds ago   Up 1 second              service1-1
357917766e1e   ubuntu:latest   "tail -f /dev/null"   14 seconds ago   Up 2 seconds             service2-1
  1. Kill one of the containers docker kill 7d
  2. The wait command doesn't exit, but prints that the container was killed.
  3. Kill the other container docker kill 35
  4. The wait command prints that the second container was killed, and exits.

Compose Version

Docker Compose version v2.29.1

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.11.2+azure-1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 8
  Running: 0
  Paused: 0
  Stopped: 8
 Images: 26
 Server Version: 23.0.6+azure-2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 nvidia
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: 82f18fe0e44a59034f3e1f45e475fa5636e539aa
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.15.0-1042-azure
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 36
 Total Memory: 433GiB
 Name: normar1-compute-a10
 ID: 4550194d-ba4a-4572-97e6-5994cbaf589a
 Docker Root Dir: /images/disk1/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented Aug 19, 2024

Block until the first service container stops

This means the first container to implement the service (which can have multiple replica). If you run command with multiple services, compose will wait for each service to have at least one container to exit

closing as "not planed"

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants