compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] Broken terminal behavior in PyCharm [UPD] IDE doesn't matter

Open doctornkz-intelas opened this issue 11 months ago • 6 comments

Description

I am using JetBrains PyCharm+Gateway for remote development. I am using an internal Pycharm terminal. Today I found that the latest version of docker-compose 2.32.4 is printing w Enable Watch message over my outputs. Take a look (v2.32.4):

w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:48:51 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:48:53 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"

I see only the last 2 lines and others are masked by w Enable Watch Using 2.30.0 version - It works perfectly:

nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:42 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:44 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:46 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:48 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:50 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:52 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:54 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:57 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:49:59 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:50:01 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:50:03 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:50:05 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"
nginx_server  | 172.19.0.1 - - [28/Jan/2025:19:50:07 +0000] "GET / HTTP/1.1" 200 615 "-" "curl/7.81.0" "-"


w Enable Watch

It breaks user experience extremely - you can't debug STDOUT at all. Do we have any suggestions or something I overlooked?

Thank you!

Steps To Reproduce

Run Pycharm and create a simple config file, like this:

version: '3.9'

services:
  nginx:
    image: nginx:latest
    container_name: nginx_server
    ports:
      - "9999:80" # Maps port 9999 on your host to port 80 in the container
    restart: unless-stopped

To spawn logs, run command in the same Linux machine, or container - watch curl localhost:9999

Install version 2.30.0, for example, and run it from the internal PyCharm terminal:

$ docker compose up
WARN[0000] /*****docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 1/0
 ✔ Container nginx_server  Created                                                                                                                           0.0s 
Attaching to nginx_server
nginx_server  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_server  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_server  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_server  | 10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
nginx_server  | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
nginx_server  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_server  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh

Works perfectly!

Install version 2.32.4 and run the same manifest:

$ docker compose up
WARN[0000] /****docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Running 1/1
 ✔ Container nginx_server  Created                                                                                                                            0.0s
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
w Enable Watch
nginx_server  | 2025/01/28 19:55:10 [notice] 1#1: start worker process 24
nginx_server  | 2025/01/28 19:55:10 [notice] 1#1: start worker process 25

We are getting the mess of the lines.

Compose Version

$ docker compose version
Docker Compose version v2.32.4

Docker Environment

$ docker info
Client: Docker Engine - Community
 Version:    27.5.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 51
  Running: 20
  Paused: 0
  Stopped: 31
 Images: 60
 Server Version: 27.5.1
 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: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-1011-aws
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.45GiB
 Name: ip-10-4-36-85
 ID: a14d6d65-054d-411b-9868-fc6bdd2d3a94
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

doctornkz-intelas avatar Jan 28 '25 19:01 doctornkz-intelas

Not sure about the root cause, but you can disable this by running with COMPOSE_MENU=false environment variable set

ndeloof avatar Jan 29 '25 07:01 ndeloof

@ndeloof Thank you, sir! I can't reproduce the issue anymore, in the case it appears, I will use env from @ndeloof , closing issue

doctornkz-intelas avatar Jan 29 '25 09:01 doctornkz-intelas

We are also experiencing this issue all of a sudden, with (w Enable Watch or w Disable Watch) + newline at the beggining of every single STDOUT line, which makes reading logs much harder.

Setting COMPOSE_MENU=false as per @ndeloof suggestion resolves the issue, but it does seem like there is some underlying bug that should be addressed.

vpatov avatar Jan 30 '25 00:01 vpatov

So, it's reproducible, and not only our issue. Thank you, @vpatov for the update!

doctornkz-intelas avatar Jan 30 '25 08:01 doctornkz-intelas

I forgot to add, that for us it is happening for multiple team members in their VSCode terminal, and in iTerm as well (we dont use pycharm). So the issue is not related to terminal emulator choice.

vpatov avatar Feb 06 '25 17:02 vpatov

We use docker compose up in powershell scripts in our CI/CD pipeline. The script hangs on the docker compose up and doesn't continue.

Steps to reproduce

docker-compose.yml

services:
  hello:
    image: hello-world:latest

run.ps1

Write-Host "Before Docker Compose"

docker compose  --file docker-compose.yml up

Write-Host "After Docker Compose"

Output:

PS D:\docker> .\run.ps1
Before Docker Compose
[+] Running 1/1
 ✔ Container docker-hello-1  Created                                                                                                                                                                                                                                             0.0s
Attaching to hello-1
hello-1  |
hello-1  | Hello from Docker!
hello-1  | This message shows that your installation appears to be working correctly.                                                                                                                                                                                                    
hello-1  |                                                                                                                                                                                                                                                                              
hello-1  | To generate this message, Docker took the following steps:
hello-1  |  1. The Docker client contacted the Docker daemon.                                                                                                                                                                                                                            
hello-1  |  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.                                                                                                                                                                                                    
hello-1  |     (amd64)                                                                                                                                                                                                                                                                  
hello-1  |  3. The Docker daemon created a new container from that image which runs the                                                                                                                                                                                                  
hello-1  |     executable that produces the output you are currently reading.                                                                                                                                                                                                            
hello-1  |  4. The Docker daemon streamed that output to the Docker client, which sent it                                                                                                                                                                                                
hello-1  |     to your terminal.                                                                                                                                                                                                                                                        
hello-1  |
hello-1  | To try something more ambitious, you can run an Ubuntu container with:                                                                                                                                                                                                        
hello-1  |  $ docker run -it ubuntu bash                                                                                                                                                                                                                                                
hello-1  |                                                                                                                                                                                                                                                                              
hello-1  | Share images, automate workflows, and more with a free Docker ID:
hello-1  |  https://hub.docker.com/                                                                                                                                                                                                                                                      
hello-1  |                                                                                                                                                                                                                                                                              
hello-1  | For more examples and ideas, visit:                                                                                                                                                                                                                                          
hello-1  |  https://docs.docker.com/get-started/
hello-1  |                                                                                                                                                                                                                                                                              
hello-1 exited with code 0

w Enable Watch

Notice the "After Docker Compose" log is missing.

Versions

Docker Compose: v2.32.4

Maroko avatar Mar 11 '25 15:03 Maroko

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.

github-actions[bot] avatar Aug 10 '25 00:08 github-actions[bot]