Nil pointer error when trying to attach to running container

Expected behavior

attach to running container

Actual behavior

nil pointer dereference error

Information

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
70c970390350 ubuntu “/bin/bash” 36 minutes ago Up 36 minutes agitated_curie

PS C:\Users\xyz> docker attach 70c970390350
Error ==> docker : panic: runtime error: invalid memory address or nil pointer dereference

My docker client is:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Wed Apr 27 00:34:20 2016
OS/Arch: windows/amd64 (Windows 10 Enterprise)

Steps to reproduce the behavior

  1. start a container
  2. attach to running container: docker attach #id

Hm, it works for me:

docker run -d --name topdemo ubuntu /usr/bin/top -b
3efe696ed07028026f146699f42e20440b4a2ffbf2265209725f154086d08209
C:\Users\Michael Friis> docker attach topdemo


top - 05:30:01 up  5:21,  0 users,  load average: 0.37, 0.26, 0.13
Tasks:   1 total,   1 running,   0 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.6 sy,  0.0 ni, 99.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  4043500 total,    28496 free,  3097204 used,   917800 buff/cache
KiB Swap:  4095996 total,  4052180 free,    43816 used.   802952 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
    1 root      20   0   36532   2876   2516 R   0.0  0.1   0:00.03 top

Do you have more details?

Michael,

It does work when I specify the same command line parameters. I used this command (copied from the Docker Quickstart website):

docker run -i -t ubuntu /bin/bash

I get this error:

S C:\Users\cbirmele> docker run -i -t ubuntu /bin/bash
docker : panic: runtime error: invalid memory address or nil pointer dereference

Are you using Powershell ISE? See http://superuser.com/questions/1047738/powershell-ise-cannot-attach-to-docker-container-windows-container

Yes I do :slight_smile: Thanks for helping out!

I recommend using a different terminal, more details: https://github.com/docker/docker/pull/22951