Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker ps not showing my container it shows in ps-a

Tags:

docker

Hi i am new user on ubuntu during my practice i install docker by

sudo apt install docker.io

Check the version and all thing properly i started working after it i pull the ubuntu image by

sudo docker pull ubuntu

after it i check the image by

sudo docker images

image is shown by all details after that i make the container by

sudo docker container run -it ubuntu /bin/bash

when i try to see my container by

sudo docker ps

the result is blank

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

But when i write this command

sudu docker ps -a

this shows me the container

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                    PORTS               NAMES
110359388f2d        ubuntu              "/bin/bash"         21 hours ago        Exited (0) 21 hours ago                       stupefied_dewdney

How to fix this? Why my container is not showing in docker ps ?

like image 906
Eva Avatar asked Feb 12 '20 12:02

Eva


1 Answers

So there is a difference between docker ps and docker ps -a

docker ps: shows the running container on your host
docker ps -a: this shows running and exited containers on the host.

So in your case your container is exited, means not running on the host thats why this shows in docker ps -a

like image 188
anand Avatar answered Oct 08 '22 19:10

anand