Docker image, container removal

For regular docker learning and command usage, please go to: https://www.runoob.com/docker/docker-tutorial.html

Remove the mirror from docker:

The first step: stop the container, docker stop the CONTAINER ID of the container or the NAMES of the container. (Note: Check if there is a repetition and determine the value to be stopped)

For example: docker stop mysql          instance uses NAMES

Step 2: Remove the container, the CONTAINER ID of the docker rm container or the NAMES of the container

For example: docker rm c7109f74d339            instance uses CONTAINER ID

Step 3: View and remove the image, docker images (function: view image).

The IMAGE ID of the docker rmi image or the REPOSITORY of the image (Note: whether the IMAGE ID is duplicated, if there is duplicate, it is recommended to use REPOSITORY)

For example: docker rmi docker.io/hello-world          instance uses REPOSITORY.

If there is a label written by the user during installation on the container , you can use: docker rmi docker.io/mysql:5.7

Force removal: use -f or --force. You can remove the image regardless of the container reference, but I think this method is not safe.

Docker container removal:

View all containers: docker ps -a displays all running, Exited, and Created containers

Remove the container: command one, docker rm $(docker ps -a -q); command two, docker rm $(docker ps -qf status=status value);

Command 3: docker container prune (docker1.13)

Guess you like

Origin blog.csdn.net/FV8023/article/details/94397593