Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tty: true in docker-compose.yml no longer displays console output #9288

Closed
3 tasks done
khalwat opened this issue Mar 15, 2022 · 14 comments
Closed
3 tasks done

tty: true in docker-compose.yml no longer displays console output #9288

khalwat opened this issue Mar 15, 2022 · 14 comments

Comments

@khalwat
Copy link

khalwat commented Mar 15, 2022

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

Console output from services running that have tty: true in the docker-compose.yml will display

Actual behavior

After updating to Docker Desktop / Mac 4.6.0 (75818), any services that have tty: true in the docker-compose.yml no longer display

The containers are actually running just fine, and I can see the logs in the Docker Desktop application, but they are no longer visible in the console.

Removing the tty: true line from the docker-compose.yml file causes it to output as expected

I have both these Experimental features on:

  • Use the new Virtualization framework
  • Enable VirtioFS accelerated directory sharing

...but turning them off and restarting Docker Desktop did not change the lack of logging

Information

  • macOS Version: 12.2.1 (21D62)
  • Intel chip or Apple chip: Apple M1 Max
  • Docker Desktop Version: 4.6.0 (75818)

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

I have both these Experimental features on:

  • Use the new Virtualization framework
  • Enable VirtioFS accelerated directory sharing

...but turning them off and restarting Docker Desktop did not change the lack of logging

Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0031: does the Docker API work?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0011: are the LinuxKit services running?
[FAIL] DD0016: is the LinuxKit VM running? vm is not running: vm has not started
[PASS] DD0001: is the application running?
[PASS] DD0018: does the host support virtualization?
[FAIL] DD0017: can a VM be started? vm has not started: vm has not started
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0007: is the backend responding?
[PASS] DD0014: are the backend processes running?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0012: is the VM networking working?
[PASS] DD0032: do Docker networks overlap with host IPs?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0019: is the com.docker.vmnetd process responding?
[PASS] DD0033: does the host have Internet access?

Please investigate the following 1 issue:

1 : The test: can a VM be started?
Failed with: vm has not started: vm has not started

The Docker engine runs inside a Linux VM. Therefore we must be able to start Virtual Machines.

Steps to reproduce the behavior

  1. Set tty: true on a service in the docker-compose.yml
  2. Do docker-compose up
  3. See lack out output from service
@mat007 mat007 transferred this issue from docker/for-mac Mar 15, 2022
@khalwat
Copy link
Author

khalwat commented Mar 15, 2022

Potentially related to #9201

@tanzislam
Copy link

tanzislam commented Mar 15, 2022

This behavior started with Docker Compose v2.3.0. v2.2.3 was fine. I've verified this behavior change on Linux.

khalwat pushed a commit to nystudio107/plugindev that referenced this issue Mar 17, 2022
khalwat added a commit to nystudio107/devmode that referenced this issue Mar 18, 2022
khalwat pushed a commit to nystudio107/spoke-and-chain that referenced this issue Mar 19, 2022
khalwat pushed a commit to nystudio107/europa-museum that referenced this issue Mar 19, 2022
@nroi
Copy link

nroi commented Mar 19, 2022

I can also confirm this issue on Linux. I ran git bisect, and it seems to be introduced by 65ed8cf.

@glenpike
Copy link

This is a frustrating fix. We use tty: true so we can attach to containers for interactive debugging, e.g. byebug in Ruby, but most of the time we also want to see container output without having to run a separate terminal window to follow the logs...

banesullivan added a commit to girder/django-large-image that referenced this issue Mar 22, 2022
banesullivan added a commit to girder/django-large-image that referenced this issue Mar 22, 2022
banesullivan added a commit to girder/django-large-image that referenced this issue Mar 22, 2022
@yoshiya0503
Copy link

yoshiya0503 commented Mar 23, 2022

hey guys, there are unwilling workaround...

1 set tty: true
2 docker compose up -d
3 docker compose logs -f

we can see logs (colorlized) same as before.

(BE CAREFUL TO CONFLICT CONTAINER PORT RUNNING WITH OTHER DETACHED CONTAINER)

kofrezo added a commit to innogames/serveradmin that referenced this issue Mar 25, 2022
Setting tty to true for docker compose >= 2.3.x hides output written to
stdout we want to see. We are not using interactive mode so it should be
safe to remove.

See: docker/compose#9288
@aviau
Copy link
Contributor

aviau commented Mar 25, 2022

On my end it seems that it causes more than just missing logs. I am building something with webpack in tty mode (so that I have colored logs) and it seems that webpack hangs when the build is completed and never starts the dev server.

Not sure how to debug this, but it could be that webpack is trying to open the terminal and it hangs?

@chloerei
Copy link

chloerei commented Apr 2, 2022

esbuild also needs to set tty: true, otherwise it will exit watch mode. But in version 4.6.0 setting tty: true it doesn't show the logs of esbuild. Now I fallback to version 4.5.0.

@ndeloof
Copy link
Contributor

ndeloof commented Apr 4, 2022

Can you please confirm this issue still applies to v2.4.0?
Main reason for me to ask is that, with #9258, compose now uses the same codebase as docker run command and should then offer the same user experience regarding tty management and ability to attach to container to collect console output.

@alexandernst
Copy link

@ndeloof the issue doesn't seem to be fixed with 2.4.0 (tested on a MBP M1)

@nroi
Copy link

nroi commented Apr 4, 2022

It didn't work for me on version 2.4.0 either, but it's now fixed with 2.4.1.

@alexandernst
Copy link

Yes, 2.4.1 fixes this issue.

@dedene
Copy link

dedene commented Apr 5, 2022

I can also confirm, 2.4.1 fixes the issue! 🙌 Thanks for the fix!

@ndeloof ndeloof closed this as completed Apr 7, 2022
@aviau
Copy link
Contributor

aviau commented Apr 7, 2022

Not fixed for me on 2.4.1 :(

How can I help debug? I am on macOS (docker desktop)

I am running vue-cli-service serve --watch

edit: nevermind. Turning it off and on again fixed the issue while I was trying to build a simple repro 🙃 . Thanks for the fix!

@ell1e
Copy link

ell1e commented Oct 28, 2024

I seem to still have this problem with docker-compose v2.29.7, although perhaps I'm doing something wrong:

$ cat Dockerfile.build-x64 

FROM alpine:latest

RUN mkdir -p /home/workuser && mkdir -p /home/persistent-workspace/ && apk update && apk upgrade --no-interactive && apk add --no-interactive git bash vim nano wget curl unzip autoconf make findutils gcompat sudo binutils file && wget -O /home/workuser/install_toolchain_x86_64.sh https://github.com/adonis0147/devel-env/releases/download/v2024.10/install_toolchain_x86_64.sh && chmod +x /home/workuser/install_toolchain_x86_64.sh && adduser -D -u 10000 -h /home/workuser workuser && chown -R workuser /home/workuser && chown workuser /home/persistent-workspace

RUN echo -e "#/bin/bash\n\
cd /home/workuser/ && ./install_toolchain_x86_64.sh portable-gcc-toolchain\n\
" > /home/workuser/extract-toolchain.sh && chmod +x /home/workuser/extract-toolchain.sh

RUN sudo -u workuser /home/workuser/extract-toolchain.sh

RUN echo -e "export PATH=/home/workuser/portable-gcc-toolchain/compiler/bin:$PATH\n\
" > /home/workuser/.bashrc && chmod +x /home/workuser/.bashrc && chown -R workuser /home/workuser/

VOLUME /home/persistent-workspace/

WORKDIR /home/persistent-workspace/

USER workuser

CMD ["/bin/bash"]


$ cat docker-compose.build-x64.yml 

services:
  build_x64:
    platform: linux/amd64
    network_mode: "bridge"
    build:
      context: ./
      dockerfile: Dockerfile.build-x64
    stdin_open: true
    tty: true
    volumes:
    - ./persistent-workspace/:/home/persistent-workspace/:rw

$ sudo docker-compose -f docker-compose.build-x64.yml up
[+] Running 1/0
 ✔ Container portable-reproducible-gcc-build_x64-1  Created                0.0s 
Attaching to build_x64-1

...and here it hangs forever. Specifically, there is no bash shell coming up as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests