compose: [BUG] TUI spams lines when container count is larger than terminal height

Description

The output of docker compose up overwhelms my terminal when my compose.yaml’s container count exceeds the terminal height.

Steps To Reproduce

  • Create a compose.yaml file with this content:
x-service: &default-service
  image: nginx:latest
  command: >
    bash -c "sleep 10 && nginx -g 'daemon off;'"
  healthcheck:
    test: service nginx status || exit 1
    interval: 2s
    timeout: 1s
    retries: 200
    start_period: 600s

services:
  svc_a:
    <<: *default-service
  svc_b:
    <<: *default-service
    depends_on:
      svc_a:
        condition: service_healthy
  svc_c:
    <<: *default-service
    depends_on:
      svc_b:
        condition: service_healthy
  svc_d:
    <<: *default-service
    depends_on:
      svc_c:
        condition: service_healthy
  svc_e:
    <<: *default-service
    depends_on:
      svc_d:
        condition: service_healthy
  svc_f:
    <<: *default-service
    depends_on:
      svc_e:
        condition: service_healthy
  svc_g:
    <<: *default-service
    depends_on:
      svc_f:
        condition: service_healthy
  svc_h:
    <<: *default-service
    depends_on:
      svc_g:
        condition: service_healthy
  svc_i:
    <<: *default-service
    depends_on:
      svc_h:
        condition: service_healthy
  svc_j:
    <<: *default-service
    depends_on:
      svc_i:
        condition: service_healthy
  svc_k:
    <<: *default-service
    depends_on:
      svc_j:
        condition: service_healthy
  svc_l:
    <<: *default-service
    depends_on:
      svc_k:
        condition: service_healthy
  • Make terminal 11 lines high
  • Run docker compose up -d
  • Notice terminal scroll

Compose Version

Docker Compose version v2.16.0

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.16.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 41
  Running: 38
  Paused: 0
  Stopped: 3
 Images: 40
 Server Version: 23.0.0
 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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 31aa4358a36870b21a992d3ad2bef29e1d693bec
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-58-generic
 Operating System: Ubuntu 22.04.1 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 31.35GiB
 Name: <redacted>
 ID: <redacted>
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 420
  Goroutines: 457
  System Time: 2023-02-08T12:09:13.563395835-05:00
  EventsListeners: 2
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://<redacted/
 Live Restore Enabled: false

Anything else?

Issue created as requested by @ndeloof from over here https://github.com/docker/compose/issues/8800#issuecomment-1422640358

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 24
  • Comments: 17 (4 by maintainers)

Most upvoted comments

I don’t know if that question was rhetorical, but I’ll share my 2 cents. 😁

There are two solutions that I would find very acceptable.

[+] Running 39/40     Networks (2), Volumes (6), Created (4), Waiting (1), Healthy (27), Exited (2)

I’m obviously very open to other solutions too.

@mrt-xci you can run compose with --progress plain to disable ANSI progress mode

not fixed, and no obvious fix in mind

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Issue is perfectly valid, but then the question is: what would be a reasonable behavior when terminal height is not large enough for the amount of services we want to show progress details ?

If you can reliably determine how much height is available, perhaps just show the first N - 1 containers that launch (where “N” is the most you can fit), and use the last line to aggregate/summarize the rest, e.g. “+3 more…”

Would it also not be possible to change the ‘sort’ order for the containers when being pulled, so that the ones currently being pulled are on the bottom lines (and not off screen, as is the case currently with lots of services). So you can at least see what is happening? This won;t help you see how many more are left to be pulled, but is it a start.

As a work-around I’ve found when I set the --parallel to 2 it is a lot less chaotic. However, it will take longer to build your project, so that might not be useful for most.