Docker container doesn't exist, but does!

I’m using Docker version 1.4.1, build 5bc2ff8, with boot2docker. When I bring up a MongoDB container from mongo:latest, all goes fine, and I get a container that I can connect to without issue. However, when I build an Ubuntu container from ubuntu:latest, I get all sorts of odd, and possibly connected, behaviours exhibited.

docker inspect --format {{ .Id }} name tells me that container ID of the container called name. I trust that, as a container ID is returned, my container has been created. However, when I try to docker exec or docker attach to that container, I’m told i doesn’t exist. I assume that it has been created at some point, in order to return the container ID, but then dies before I exec or attach. The debug output (with docker -D) isn’t that useful.

When I try to use docker inspect --format {{ .NetworkSettings.IPAddress }} name, to get name’s IP address, I get told that the same container has no IP address (or, that <no value> is returned). I also can’t see it when I do docker ps, so I assume it is dying. But I might be wrong.

Seems very odd. Is there a way to see why containers just die, or to otherwise debug this?

Thanks,

Andrew

I fixed this in the end. A colleague pointed out that I’d need a long-running process to avoid the container quitting quickly because the command ended with a zero exit code.

FYI, docker ps only shows currently running containers. To show all containers that exist on your system, do docker ps -a.