compose: [BUG] Overlapping print rows while building

Description

When docker-compose is building images the printout seems to be confused about which rows to use. It prints out, e.g., both a Dockerfile instruction, like COPY, as well as the current container status on the same row. This results in a constant switching between what is written.

Steps To Reproduce

  1. Enter a directory with a docker-compose.yml file
  2. Run docker-compose build --no-cache

Compose Version

`docker compose version`:
`Docker Compose version 2.31.0`

`docker-compose version`:
`Docker Compose version 2.31.0`

Docker Environment

Client:
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.31.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 4
  Running: 3
  Paused: 0
  Stopped: 1
 Images: 978
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  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: 207ad711eabd375a01713109a8a197d197ff6542.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.6.63-1-MANJARO
 Operating System: Manjaro Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 13.34GiB
 Name: Saturn
 ID: e1c30eb4-300f-4d4d-97d4-2cdbd78aeca8
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

I don’t really know what caused it to happen. I know the steps to reproduce aren’t satisfactory but I’m not sure what else to write. Any insight regarding the printout is appreciated. Here’s an image as well as a video of the building process. Image https://github.com/user-attachments/assets/4a0d560c-3ce1-4192-ae2d-533789d41b45 Running with --progress plain works of course but that’s sidestepping the issue. I tried reinstalling. Neither different terminals nor tty changed anything. P.S. build specifically doesn’t have to be run, anything that would cause that specific progress type to display works.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 27
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I made a duplicate issue by accident, here’s a gif I made of the problem though for reference

Image

Fix is in v2.32.3

Just checking - I see this issue is closed but I’m still having this issue on a brand new install. When is the fix for this going to be released?

The issue seems to stem for two writers writing to Stdout and Stderr at the same time.

Interestingly enough, if I run docker compose build >/dev/null I get this clean output:

[+] Building 1/1
 ✔ Service test  Built1.1s 0s 

And if I run docker compose build 2>/dev/null I get another clean output:

[+] Building 0.6s (7/7) FINISHED                                                                             docker:default
 => [test internal] load build definition from Dockerfile                                                              0.0s
 => => transferring dockerfile: 115B                                                                                   0.0s
 => [test internal] load metadata for docker.io/library/ubuntu:24.04                                                   0.5s
 => [test internal] load .dockerignore                                                                                 0.0s
 => => transferring context: 2B                                                                                        0.0s
 => [test 1/2] FROM docker.io/library/ubuntu:24.04@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6  0.0s
 => CACHED [test 2/2] RUN apt-get -y update && apt-get -y install netcat-openbsd                                       0.0s
 => [test] exporting to image                                                                                          0.0s
 => => exporting layers                                                                                                0.0s
 => => writing image sha256:8c2534414ce76df77505dc59da6e4939ff89e24321da5912ede591194781bbc7                           0.0s
 => => naming to docker.io/library/example-test                                                                        0.0s
 => [test] resolving provenance for metadata file                                                                      0.0s

So the issue seems to be the mixing of two outputs. Since the second output is more than enough, disabling the Stderr output could be a workaround.

OR

~We could just decide to use either Stdout or Stderr for both buildkit and compose output, and not both.~ After testing, I can say that won’t work. We would get the same jitters, only a little cleaner.

Perhaps buildkit output needs to always be two lines above the compose output - that way both would get their own scratch space and not trample each other.

Docker compose version v2.32.1 still having this problem

Just received an email recommending upgrading to Docker Desktop 4.37.2 (179585) with Compose: v2.31.0-desktop.2 and the flickering issue is still happening.

I also noticed this issue. Seems we need to disable compose progress UI while buildkit is using the console to render build state

Downgraded to 4.36 and problem still persists. Builds are super slow and unstable.

Disabling buildkit fixes the flicker at the cost of time but something is def off. Builds that took a min now go into 5+ minutes.

@Gavriel94 if you download the newer version of Compose to ~/.docker/cli-plugins/docker-compose (your path might vary) then docker<space>compose will use it ✨

☝️ make sure to remove it again once a new version of Desktop is available, otherwise that “override” continues to take priority, so you won’t get updated versions that ship with docker desktop 😅

@Gavriel94 if you download the newer version of Compose to ~/.docker/cli-plugins/docker-compose (your path might vary) then docker<space>compose will use it ✨

Yeah something is cooked. Ever since it started flickering the builds take much longer.

In case useful for those looking into this; we had some pull requests in docker/cli recently to fix a similar issue for docker stats on Windows; here’s the pull requests that helped mitigate those, in case a similar patch would help for this case;

Update: I works fine after downgrading to earlier versions of docker-compose, for example 2.30.3.