-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
Description
We have a self-hosted repo where we provide a Dockerized version of our application for small installs. Our install script for this repo is fairly involved, and one of the things we do is capture stdout/stderr in a file to aid in debugging installation issues:
exec &> >(tee -a "$log_file")
Straightforward enough, and it works fine with Docker Compose v1.
With Docker Compose v2, we're seeing that— following the logging capture—a docker compose run invocation that prompts for input will hang indefinitely, and can't be killed with Ctrl-C either. I've whittled down a test case.
Steps to reproduce the issue:
- Clone https://github.com/chadwhitacre/docker-compose-v2-tty-bug/.
- Ensure
which docker-composeresolves to Docker Compose v1. - Ensure
which dockerresolves to a Docker with Compose v2. ./test.sh
Describe the results you received:
The test script accepts three prompts, then hangs.
$ ./test.sh
[+] Running 2/2
⠿ Container tty-test_testing_run_397b9b93f30e Removed 0.0s
⠿ Network tty-test_default Removed 0.1s
[+] Building 0.1s (8/8) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:latest 0.0s
=> [1/3] FROM docker.io/library/ubuntu:latest 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 34B 0.0s
=> CACHED [2/3] WORKDIR /app 0.0s
=> CACHED [3/3] COPY ./entrypoint.sh /app 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:f56005f2b65454c8f5ea738a6caf0237f4727243937d75a7424d45ef2592ced2 0.0s
=> => naming to docker.io/library/tty-test_testing 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Creating network "tty-test_default" with the default driver
Creating tty-test_testing_run ...
Creating tty-test_testing_run ... done
Program: foo
Greetings, foo!
Program: bar
Greetings, bar!
Creating tty-test_testing_run ...
Creating tty-test_testing_run ... done
Program: baz
Greetings, baz!
Aaaaaaaaaaaaaaand ...
Describe the results you expected:
The test script accepts four prompts, then exits cleanly.
Output of docker compose version:
$ docker compose version
Docker Compose version v2.0.0
$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
$
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Build with BuildKit (Docker Inc., v0.6.3)
compose: Docker Compose (Docker Inc., v2.0.0)
scan: Docker Scan (Docker Inc., v0.8.0)
Server:
Containers: 3
Running: 2
Paused: 0
Stopped: 1
Images: 29
Server Version: 20.10.8
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
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: e25210fe30a0a703442421b0f60afac609f950a3
runc version: v1.0.1-0-g4144b63
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.47-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.64GiB
Name: docker-desktop
ID: LNAI:QCLJ:TERN:UEWD:TS3G:M63J:OH2W:FFX7:FTNM:7WZL:7QUE:EIPU
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Metadata
Metadata
Assignees
Labels
No labels