compose icon indicating copy to clipboard operation
compose copied to clipboard

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

Open ericslandry opened this issue 2 years ago • 11 comments

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

ericslandry avatar Feb 08 '23 17:02 ericslandry

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 ?

ndeloof avatar Feb 13 '23 15:02 ndeloof

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.

  • Revert to a plain (non-fancy) output as referenced here https://github.com/docker/compose/issues/8753#issuecomment-934473781
  • Make the fancy output fit on one line by summarizing it:
[+] Running 39/40     Networks (2), Volumes (6), Created (4), Waiting (1), Healthy (27), Exited (2)

I'm obviously very open to other solutions too.

ericslandry avatar Feb 14 '23 18:02 ericslandry

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.

Yinette avatar Mar 06 '23 07:03 Yinette

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.

ajw107 avatar Mar 29 '23 15:03 ajw107

+1

thenick775 avatar Apr 30 '23 17:04 thenick775

I comment to let you know that using Android JuiceSSH And docker-compose 2.17.2 this scroll spam still occurs

williamdes avatar Apr 30 '23 22:04 williamdes

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 ?

is it impossible to allow scrolling? I'll admit I have no experience with how TUI works normally, but is it not possible to treat the output as you would any webpage and allow scrolling when the contents are too tall for the window?

henryxparker avatar Jun 30 '23 16:06 henryxparker

I would love to see a plaintext version come back with inline text updates, only output text on complete changes.

ITJamie avatar Aug 23 '23 22:08 ITJamie