[Docker-6]-Docker deletes the running image

table of Contents

  1. Unrun image
  2. Image run

1. Mirror that has not been run

The command to delete images in docker is docker rmi

Second, the running image

At this time, executing the above command cannot delete images

It can be seen that the image cannot be deleted. Prompt image is referenced by a container (used to run). If this referenced container is not destroyed (deleted), then the image must not be deleted. See the specific reason at the end of the article

2.1 Delete in container: docker rm 539773f6c852

2.2 Delete in images : docker rmi hellotest

 

Reasons for synchronous deletion:

Check the help of docker and you will find that there are two commands related to deletion rm and rmi

There are two different words here, images and container.

Among them, images means the image of a virtual machine that is usually used, which is equivalent to a template;

The container is the state of the image runtime. Docker keeps a state for the image that has been run (container), you can use the command docker ps to view the running container, and for the container that has exited, you can use docker ps -a to view. If you exit a container and forget to save the data, you can use docker ps -a to find the corresponding running container and use the docker commit command to save it as an image and then run it.

Guess you like

Origin www.cnblogs.com/yifanrensheng/p/12734343.html