Container names not displaying

Pretty straight forward and repeatable problem once it shows up. When I run docker ps -a the names display. Run the command again and the names don’t show. Run it again and the names come back. Run it once again the names are gone. Here’s the bigger issue, if I were to run some other command such as a docker stop or docker inspect right after the names are displayed I will get the error of “Error: No such image or container: testname”. But if I ran the command after a docker ps -a where the names don’t show up the command runs fine.

Server: Ubuntu 14.04.3 (3.19 kernel)
Docker Version:
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

It almost sounds like you have some sort of round robin load balancing happening between you and docker.

If you run tail -f /var/log/docker.log on the docker host, do you see activity every time you run docker ps? or only when you see your containers listed?

When you say the names don’t show up, do you mean the entire entry? (there is also an id, ports, and image name listed on each line)

The only log I have is /var/log/upstart/docker.log. Which only shows INFO[18498] GET /v1.19/containers/json?all=1 every time I run a docker ps -a.

Everything else will show up fine. It’s just the names that aren’t show up.

Can you paste some sample output showing this?

Also, I’d be interested to see what the json output looks like. Can you ssh in to your docker host and run the following?

echo -en "GET /v1.19/containers/json HTTP/1.1\r\nHost: /var/run/docker.sock\r\nUser-Agent: Docker-Client/1.8.1 (linux)\r\n\r\n" | socat stdio unix-connect:/var/run/docker.sock

On my system, that produces the following output:

HTTP/1.1 200 OK
Content-Type: application/json
Server: Docker/1.8.1 (linux)
Date: Fri, 04 Sep 2015 22:26:13 GMT
Content-Length: 324

[{"Id":"49e057d3eb25a1c3e857f18504b077b386dddc71a531be646964b1f4aa946405","Names":["/drunk_fermi"],"Image":"nginx","Command":"nginx -g 'daemon off;'","Created":1441405471,"Ports":[{"PrivatePort":443,"Type":"tcp"},{"PrivatePort":80,"Type":"tcp"}],"Labels":{},"Status":"Up 56 seconds","HostConfig":{"NetworkMode":"default"}}]

These commands are run within a second of each other.

root@sdslnxkvm4:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97447f371692 sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp
a27469782e95 sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp
c194847ec41d sdslnxdockrepo1.topechelon.corp/bigbiller:1569 “/sbin/my_init” 3 days ago Up 3 days 443/tcp, 0.0.0.0:2280->80/tcp
root@sdslnxkvm4:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97447f371692 sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp bigbiller_workers
a27469782e95 sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp bigbiller_scheduled_tasks
c194847ec41d sdslnxdockrepo1.topechelon.corp/bigbiller:1569 “/sbin/my_init” 3 days ago Up 3 days 443/tcp, 0.0.0.0:2280->80/tcp bigbillerwebapp
root@sdslnxkvm4:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97447f371692 sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp
a27469782e95 sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569 “/sbin/my_init” 3 days ago Up 3 days 80/tcp, 443/tcp
c194847ec41d sdslnxdockrepo1.topechelon.corp/bigbiller:1569 “/sbin/my_init” 3 days ago Up 3 days 443/tcp, 0.0.0.0:2280->80/tcp

The echo to socat command is returning the same results every time.

HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 08 Sep 2015 13:42:19 GMT
Content-Length: 1016

[{“Id”:“97447f37169283c9889e4fb427e2177739f7dfcb2a77822f190df4bfcb3c8cfa”,“Names”:["/bigbiller_workers"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569”,“Command”:"/sbin/my_init",“Created”:1441397555,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“PrivatePort”:80,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“a27469782e95d2d2721958b79fdef9d5a063ebdf69313732d4a0e2f9a5306bd9”,“Names”:["/bigbiller_scheduled_tasks"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569”,“Command”:"/sbin/my_init",“Created”:1441397100,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“PrivatePort”:80,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“c194847ec41da67c003b6b8dd5c9d22a65fd45a6086a9708eebe66d5645b9dde”,“Names”:["/bigbillerwebapp"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller:1569”,“Command”:"/sbin/my_init",“Created”:1441397071,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“IP”:“0.0.0.0”,“PrivatePort”:80,“PublicPort”:2280,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”}]

I take back the second statement. I was wrong. It is returning nulls for the names just like the docker ps -a command but the docker command isn’t showing the null values. Below is an example.

HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 08 Sep 2015 18:50:59 GMT
Content-Length: 1016

[{“Id”:“97447f37169283c9889e4fb427e2177739f7dfcb2a77822f190df4bfcb3c8cfa”,“Names”:["/bigbiller_workers"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569”,“Command”:"/sbin/my_init",“Created”:1441397555,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“PrivatePort”:80,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“a27469782e95d2d2721958b79fdef9d5a063ebdf69313732d4a0e2f9a5306bd9”,“Names”:["/bigbiller_scheduled_tasks"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569”,“Command”:"/sbin/my_init",“Created”:1441397100,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“PrivatePort”:80,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“c194847ec41da67c003b6b8dd5c9d22a65fd45a6086a9708eebe66d5645b9dde”,“Names”:["/bigbillerwebapp"],“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller:1569”,“Command”:"/sbin/my_init",“Created”:1441397071,“Ports”:[{“IP”:“0.0.0.0”,“PrivatePort”:80,“PublicPort”:2280,“Type”:“tcp”},{“PrivatePort”:443,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”}]
root@sdslnxkvm4:~# echo -en “GET /v1.19/containers/json HTTP/1.1\r\nHost: /var/run/docker.sock\r\nUser-Agent: Docker-Client/1.8.1 (linux)\r\n\r\n” | socat stdio unix-connect:/var/run/docker.sock
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 08 Sep 2015 18:51:01 GMT
Content-Length: 956

[{“Id”:“97447f37169283c9889e4fb427e2177739f7dfcb2a77822f190df4bfcb3c8cfa”,“Names”:null,“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_workers:1569”,“Command”:"/sbin/my_init",“Created”:1441397555,“Ports”:[{“PrivatePort”:80,“Type”:“tcp”},{“PrivatePort”:443,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“a27469782e95d2d2721958b79fdef9d5a063ebdf69313732d4a0e2f9a5306bd9”,“Names”:null,“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller_scheduled_tasks:1569”,“Command”:"/sbin/my_init",“Created”:1441397100,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“PrivatePort”:80,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”},{“Id”:“c194847ec41da67c003b6b8dd5c9d22a65fd45a6086a9708eebe66d5645b9dde”,“Names”:null,“Image”:“sdslnxdockrepo1.topechelon.corp/bigbiller:1569”,“Command”:"/sbin/my_init",“Created”:1441397071,“Ports”:[{“PrivatePort”:443,“Type”:“tcp”},{“IP”:“0.0.0.0”,“PrivatePort”:80,“PublicPort”:2280,“Type”:“tcp”}],“Labels”:{},“Status”:“Up 3 days”}]

Any other ideas? This is really causing some issues with some custom scripts we wrote that depend on the names.