docker / docker/cli

Strange behaviour piping docker -i to "less"

Open
#2,189 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement status/0-triage version/19.03
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

I'm using a build tool for Haskell called Stack, which supports building and running in Docker. I've reported an issue to them about piping the output of a project running in Docker into "less", and it was confirmed to be related to Docker's interactive mode. For reasons of simplicity, they want to always pass -i to Docker, but if the output of docker -i is piped into "less", the keyboard doesn't work properly.

Is this something that is best solved in Docker or in Stack? Most other programs don't seem to require users to distinguish between interactive and non-interactive mode. Is this specific to Docker, or can it be worked around?

Steps to reproduce the issue:

  1. Install Stack
  2. Clone the repository at https://github.com/torgeirsh/stack-test
  3. Run "stack run | less" (which essentially is "docker -i <other options> | less")

Describe the results you received:

The keyboard doesn't work properly in "less", with random keystrokes being ignored or misinterpreted.

Describe the results you expected:

"less" can be operated normally to scroll the output from the program, etc.

Output of docker version:

Client:
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.9
 Git commit:        6a30dfca03
 Built:             Mon Sep 16 03:56:22 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.9
  Git commit:       6a30dfca03
  Built:            Wed Sep 11 22:45:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10-0ubuntu1
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:        

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 10
  Running: 1
  Paused: 0
  Stopped: 9
 Images: 32
 Server Version: 19.03.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 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: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 
 runc version: 
 init version: 
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.3.0-19-generic
 Operating System: Ubuntu 19.10
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 23.24GiB
 Name: xxxxxxx
 ID: MHJS:DIUT:QWDG:C3XO:YHLX:K2EX:SEJJ:S3EL:DPXP:ZLTG:O2VO:D6TQ
 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

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

Running docker locally.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing stack run | less from the linked stack-test repository, then compare it with the equivalent docker -i invocation and review Stack issue 5064. Done would mean identifying whether Docker CLI or Stack owns the behavior and documenting an agreed fix or workaround that lets less accept keyboard input normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.