简体   繁体   中英

docker container exist but does not run with container ID

I have created a container locally. Then, I run the following command:

docker ps -a

output is:

ONTAINER ID   IMAGE     COMMAND      CREATED        STATUS                        PORTS     NAMES
abc6f4d50931   airflow   "/bin/zsh"   17 hours ago   Exited (137) 21 minutes ago             xenodochial_mclaren

Then I try to run the container with the following command, it create a new container with same IMAGE but different container ID instead opening the container with this image name which exist.

docker run -p 8080:8080 -it airflow /bin/zsh/

The output of docker images command is:

REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
airflow                  airflow   63e2e36735a6   46 hours ago   704MB
airflow                  latest    63e2e36735a6   46 hours ago   704MB
docker/getting-started   latest    083d7564d904   6 weeks ago    28MB

Why is this creating new containers?

If you run docker run ... you spin out a new cointainer from the image.

The status of your container is Exited as you can check from the docker ps -a output.

If you want to start again the same container, you can try docker start abc6f4d50931 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM