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

[BUG] Keypresses are swallowed when piping docker compose exec output to less #11775

Open
rkfg opened this issue Apr 28, 2024 · 2 comments
Open

Comments

@rkfg
Copy link

rkfg commented Apr 28, 2024

Description

When running commands like docker compose exec containername mysql... | less you've got to press keys twice (or more) for them to take effect.

Steps To Reproduce

  1. docker compose exec db find / | less (use any running container name instead of db)
  2. try to navigate with arrow keys
  3. only if you manage to get to the end of the output, the keys start working normally

Compose Version

Docker Compose version v2.26.1

Docker Environment

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

Server:
 Containers: 71
  Running: 17
  Paused: 0
  Stopped: 54
 Images: 61
 Server Version: 20.10.24+dfsg1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1.6.20~ds1-1+b1
 runc version: 1.1.5+ds1-1+deb12u1
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 6.1.0-20-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.39GiB
 Name: hostname
 ID: NHM3:FVMR:7XMQ:C4PM:75GM:VOLR:XVHB:VLRE:DJCY:E3HT:YNXH:AV65
 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?

Works fine if I run the same command with just docker exec and use an unscoped container name. This is a repost of issue #8428 which has been closed without any comments.

@x-yuri
Copy link
Contributor

x-yuri commented Apr 29, 2024

If you want to pipe docker exec into a pager, then you probably want to add -T:

docker compose exec -T db find / | less

If that doesn't work:

docker compose exec -T db find / </dev/null | less

The latter looks like a workaround that should not be needed.

@rkfg
Copy link
Author

rkfg commented Apr 29, 2024

-T doesn't change anything for me but </dev/null does (i.e. it works as expected with it)! It feels like compose and the pager fight for stdin which causes these skips.

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

No branches or pull requests

2 participants