Garbled output when using 'cat' command

Version 1.12-1-beta26 (build: 7018) 33f4b69
OS: Windows 10 Pro x64

When using cat to output files, the output is getting garbled, with lines overwriting each other. E.g. running either

C:\> docker run --rm --entrypoint=cat alpine /etc/services

or

C:\> docker run --rm --entrypoint=sh -ti alpine
/ # cat /etc/services

towards the end of the output I get…

caerpc          1109/tcpp                       # Pop with Kerberos
knetd           2053/tcp                        # Kerberos de-multiplexor
eklogin=========2105/tcp========================# Kerberos encrypted rlogin
# The remaining port numbers are not as allocated by IANA.
# CVSup support http://www.cvsup.org/
supfilesrv (Proj871/tcpena/MIT) services        # SUP server
supfiledbgt thes1127/tcpr Kerberos v4, and are u# SUP debugging
kpop            1/ddp                           # Routing Table Maintenance Protocol

However this is how that section of the file should look…

caerpc          42510/tcp                       # CA eTrust RPC
caerpc          42510/udp

#=========================================================================
# The remaining port numbers are not as allocated by IANA.

# Kerberos (Project Athena/MIT) services
# Note that these are for Kerberos v4, and are unofficial
kpop            1109/tcp                        # Pop with Kerberos
knetd           2053/tcp                        # Kerberos de-multiplexor
eklogin         2105/tcp                        # Kerberos encrypted rlogin

# CVSup support http://www.cvsup.org/
supfilesrv      871/tcp                         # SUP server
supfiledbg      1127/tcp                        # SUP debugging

However if you use ‘less’ instead of ‘cat’ in an interactive session, the file looks fine.

I just did a bit more digging around and have come to the conclusion that this problem manifests itself when something is slowing down the console. I originally saw this problem when I was using docker over a remote desktop connection. The output appears relatively slowly and overwrites itself.

I also see the same problem if I SSH to that box (it’s running cygwin’s SSH server) and then run docker through the winpty command.

Using docker over SSH without the winpty command seems to output the file fine (but cannot be run interactively).

1 Like