Skip to content

container shell does not have correct initial value for COLUMNS variable #36483

@shapiroj

Description

@shapiroj

Description

Docker is no longer line-wrapping correctly after upgrading to 17.12.1-ce.

Steps to reproduce the issue:

  1. Create a new container
  2. From terminal on host, echo $COLUMNS:
    root@198.18.55.163:~# echo $COLUMNS
    195
  3. Attach to container:
    root@172.25.1.1:~# docker exec -t -i 240116fb2be5 /bin/bash

Describe the results you received:
4. Show columns. This should be the same as the host. It's incorrect
which makes lines wrap incorrectly for long commands.
root@240116fb2be5:/usr/local/bin/# echo $COLUMNS
80
5. Resize terminal. Columns is set correctly.
root@240116fb2be5:/usr/local/bin/# echo $COLUMNS
164

Describe the results you expected:
same steps on a much older version (1.12.6)
4. Show columns. $COLUMNS now matches host value.
root@172.25.1.1:~# docker exec -t -i d21241ca559c /bin/bash
root@d21241ca559c:/usr/local/bin# echo $COLUMNS
195
5. Resizing terminal sets columns correctly as well.
root@d21241ca559c:/usr/local/bin# echo $COLUMNS
164

Additional information you deem important (e.g. issue happens only occasionally):
I know there are other similar issues here, namely #33910. However, we are using the static binaries: https://download.docker.com/linux/static/stable/x86_64/. It's unclear to me if this is the same since I don't believe those binaries are gentoo, and best I can tell, the issue is fixed in the code that those binaries were built from.

Output of docker version:

# docker version
Client:
 Version:	17.12.1-ce
 API version:	1.35
 Go version:	go1.9.4
 Git commit:	7390fc6
 Built:	Tue Feb 27 22:13:43 2018
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.1-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.4
  Git commit:	7390fc6
  Built:	Tue Feb 27 22:20:43 2018
  OS/Arch:	linux/amd64
  Experimental:	false

Output of docker info:

Containers: 21
 Running: 21
 Paused: 0
 Stopped: 0
Images: 218
Server Version: 17.12.1-ce
Storage Driver: zfs
 Zpool: docker
 Zpool Health: ONLINE
 Parent Dataset: docker/gc2-docker
 Space Used By Parent: 14209576960
 Space Available: 200538787840
 Parent Quota: 214748364800
 Compression: off
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: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
 userns
Kernel Version: 4.4.46-4.4.0-amd64-e3e7779462756894
Operating System: Ubuntu 14.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.65GiB
Name: a198-18-55-163.mytech.com
ID: J6H6:76CA:W4UM:FMEO:IN6C:KHWH:UPA5:RKSU:VCKB:QMQ7:CSQM:ZBWO
Docker Root Dir: /var/run/docker/100000.100000
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No kernel memory limit support

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/17.12

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions