Skip to content

Docker does not pass right terminal environment variable to container when use option -t #33910

@scsi

Description

@scsi

When I update docker to 17.06.0 and I found that docker does not pass right terminal environment variable to container when use option -t.
ex. docker run -it and docker exec -it
When I type longger command and it display dumb.
It is a big problem when I debug the docker image.
I try hard to find out what is going on.
Finally I found that docker pass wrong terminal environment variable COLUMNS and LINES to container.
In host OS, thos variable are

TERM=xterm-256color COLUMNS=141 LINES=33

but in container, thos variable are

TERM=xterm COLUMNS=141 LINES=33

The value of variable COLUMNS and LINES are exchanged.
I use gentoo and centos linux and they all have same problem.
I try to downgrade to docker version 17.3.1 and the problem gone.

thank you for your help.

Steps to reproduce the issue:

  1. echo TERM=$TERM COLUMNS=$COLUMNS LINES=$LINES
  2. docker run --rm -it centos
  3. echo TERM=$TERM COLUMNS=$COLUMNS LINES=$LINES
ssh:scsi@t1srv ~ $ echo TERM=$TERM COLUMNS=$COLUMNS LINES=$LINES
TERM=xterm-256color COLUMNS=141 LINES=33
ssh:scsi@t1srv ~ $ docker run --rm -it centos
[root@d9b153e5bdaa /]# echo TERM=$TERM COLUMNS=$COLUMNS LINES=$LINES
TERM=xterm COLUMNS=141 LINES=33

Describe the results you received:

The value of variable COLUMNS and LINES in container is exchanged.

Describe the results you expected:

The value of variable COLUMNS and LINES in container should same with host OS.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 30 00:39:06 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 30 08:38:48 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 7
 Running: 5
 Paused: 0
 Stopped: 2
Images: 737
Server Version: 17.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d24f39e203aa6be4944f06dd0fe38a618a36c764 (expected: cfb82a876ecc11b5ca0977d1733adbe58599088a)
runc version: 2d41c04 (expected: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4)
init version: v0.14.0 (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.16-gentoo
Operating System: Gentoo/Linux
OSType: linux
Architecture: x86_64
CPUs: 40
Total Memory: 62.7GiB
Name: t2srv
ID: RYTB:MJG4:NIUY:HLOX:FWMO:4Q4K:UO56:MW2K:556N:6NFR:CXSL:C5PR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 192.168.10.20:5000
 192.168.9.101:5000
 srissrv:5000
 127.0.0.0/8
Live Restore Enabled: false

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

app-emulation/docker-17.06.0
app-emulation/docker-runc-1.0.0_rc3_p20170607
app-emulation/containerd-0.2.8_p20170504

17.03.1 package info

app-emulation/docker-17.03.1
app-emulation/docker-runc-1.0.0_rc2_p20170308
app-emulation/containerd-0.2.5_p20170308

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions