compose icon indicating copy to clipboard operation
compose copied to clipboard

[BUG] ctrl+c doesn't exit docker-compose logs

Open Aerowiel opened this issue 3 years ago • 12 comments

Description

When using docker-compose version 2.14.1-1 and running docker-compose logs CONTAINER_NAME you cannot exit the prompt with CTRL+C.

Downgrading to 2.12.2 seems to fix the issue.

Steps To Reproduce

  1. Use docker-compose version 2.14.1-1
  2. Run "docker-compose logs CONTAINER_NAME"
  3. CTRL + C
  4. You cannot exit from the container

Compose Version

2.14.1-1

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc., 2.12.2)

Server:
 Containers: 34
  Running: 11
  Paused: 0
  Stopped: 23
 Images: 185
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: 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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: a05d175400b1145e5e6a735a6710579d181e7fb0.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.84-1-MANJARO
 Operating System: Manjaro Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 31.06GiB
 Name: florianpendaries
 ID: PAYU:SRVT:PHL4:337A:EZSV:MVNQ:7CM3:IWCQ:7JCN:6LAV:YGK5:Q4PF
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Aerowiel avatar Dec 21 '22 16:12 Aerowiel

Hello @Aerowiel Can you try v2.14.2, this issue should have been fixed by https://github.com/docker/compose/pull/10104

glours avatar Dec 21 '22 16:12 glours

I am also seeing this. Never seen it until upgrading to v2.14.1 a few days ago. v2.14.2 is not currently available on the Debian Bullseye main sources yet.

neponn avatar Dec 22 '22 01:12 neponn

Also encountered with v2.15.1 while following the output. (-f/--follow)

ahmetgeymen avatar Jan 25 '23 22:01 ahmetgeymen

@ahmetgeymen Can you provide a sample Compose file to reproduce this? Otherwise we can't dig into it. I'll reopen when there's more information.

laurazard avatar Jan 25 '23 22:01 laurazard

@ahmetgeymen Can you provide a sample Compose file to reproduce this? Otherwise we can't dig into it. I'll reopen when there's more information.

services:
  spring-docker:
    image: springio/gs-spring-boot-docker
    ports:
      - "8080:8080"

First running with docker compose up --build -d and then following logs with docker compose logs -f but I can't exit with CTRL + C or CTRL + Z.

ahmetgeymen avatar Jan 26 '23 00:01 ahmetgeymen

@ahmetgeymen The example you provided works fine for me. Could you try with the latest Compose version v2.15.1 and see if you still face this?

laurazard avatar Jan 26 '23 11:01 laurazard

@laurazard I've just uploaded a video showing the issue. I use docker compose v2.15.1. https://youtu.be/Wv6eAW9ImI4

ahmetgeymen avatar Jan 26 '23 12:01 ahmetgeymen

Thanks @ahmetgeymen, I can see the issue. @ndeloof, any ideas?

laurazard avatar Jan 26 '23 12:01 laurazard

indeed, trying to make logs command a background task fails. But it works when running the CLI plugin directly

$ ~/.docker/cli-plugins/docker-compose logs -f
...
truc-test-1  | 2023-01-26 12:34:52.249+0000 [id=49]	INFO	hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
^Z
[2]+  Stopped                 ~/.docker/cli-plugins/docker-compose logs -f

Same using the raw Docker CLI:

$ com.docker.cli compose logs -f
truc-test-1  | *************************************************************
truc-test-1  | 
^Z
[2]+  Stopped                 com.docker.cli compose logs -f

So, this is a Cloud integration CLI issue 😅

ndeloof avatar Jan 26 '23 12:01 ndeloof

The title of the issue focuses on version 2.14.1-1, sorry for interruption with 2.15.1. A new issue may be created or the issue title may be updated. Thanks again for your interest.

ahmetgeymen avatar Jan 26 '23 12:01 ahmetgeymen

This bug is still present in v2.18.1

docker compose up -d with any docker-compose file, and attempting to cancel with CTRL+C will cause the output to remain on the screen

ryanneufeld avatar Jul 05 '23 22:07 ryanneufeld

@ryanneufeld can you try using com.docker.cli compose ... to reproduce this issue ?

ndeloof avatar Nov 23 '23 10:11 ndeloof