docker ps shows empty list

I built a docker image from a docker file. Build said it succeeded. But when I try to show docker containers through docker ps (also tried docker ps -a), it shows an empty list. What is weird is that I'm still able to somehow push my docker image to dockerhub by calling docker push "container name".

I wonder what's going on? I'm on Windows 7, and just installed the newest version of dockertoolbox.


Solution 1:

docker ps shows (running) containers. docker images shows images.

A successfully build docker image should appear in the list which docker images generates. But only a running container (which is an instance of an image) will appear in the list from docker ps (use docker ps -a to also see stopped containers). To start a container from your image, use docker run.

Solution 2:

For me, docker ps -a and docker images both returned an empty list even tho I had many docker containers running. I tried rebooting system with no luck. A quick sudo systemctl restart docker fixed this "bug".

Solution 3:

For me, the only thing resolving the issue is to reinstall docker. Also, one must be sure that the disk is not full.

This is the command that I use, but it may vary depending on the version of docker already installed:

apt-get install --reinstall docker.io

If prompted, choose "yes" to automatically restart docker daemon

Solution 4:

for Linux,

at first, see all the running container

sudo docker ps

try restarting

sudo systemctl restart docker

remove previous docker image with the same name if there is any

sudo docker rm docker_container_id

once again run

sudo docker run -d --name container_name image_name

This should work

or uninstall docker and install it again