Kill all the containers that are running
Copy the Code code as follows:
Docker kill $ (Docker ps-a-Q)
Remove all containers that have stopped
Copy the Code code as follows:
Docker RM $ (Docker ps-a-Q)
Remove all images that have not been hit dangling tags
Copy the Code code as follows:
Docker RMI $ (Docker images-q-F Dangling=true)
Remove all mirrors
Copy the Code code as follows:
Docker RMI $ (Docker images-q)
Create aliases for these commands
Copy the Code code as follows:
# ~/.bash_aliases
# Kill all the containers that are running.
Alias Dockerkill= ' Docker kill $ (Docker ps-a-Q) '
# Remove all containers that have been stopped.
Alias Dockercleanc= ' Docker rm $ (Docker ps-a-Q) '
# Remove all non-tagged mirrors.
Alias Dockercleani= ' Docker RMI $ (Docker images-q-f dangling=true) '
# Remove all stopped containers and non-tagged mirrors.
Alias dockerclean= ' Dockercleanc | | True && Dockercleani '
Also attached is the Docker Common command
Docker version #查看版本
Docker search tutorial# searching for available docker images
Docker Pull Learn/tutorial #下载镜像
Docker run learn/tutorial echo "Hello word" #在docker容器中运行hello world!
Docker run learn/tutorial apt-get install-y ping# Installing a new program in a container
Save Image
First use the Docker ps-l command to obtain the ID of the container after the ping command is installed. Then save this image as learn/ping.
Tips:
1. Run Docker commit to view a list of parameters for this command.
2. You need to specify the ID of the Save container to submit. (Translator Press: obtained via Docker ps-l command)
3. There is no need to copy the full ID, usually the first three to four letters can be distinguished. (Translator Press: Very similar to git version number)
The correct command:
Docker commit 698 Learn/ping
Run a new image
Docker Run lean/ping Ping www.google.com
Check for images in operation
Now that you've run a Docker container, let's look at the running container.
Use the Docker PS command to see a list of all the containers that are running, and with the Docker inspect command we can view more detailed information about a particular container.
Goal:
Find the ID of a running container, and then use the Docker Inspect command to view the container's information.
Tips:
You can use the previous part of the mirror ID, which does not require a full ID.
The correct command:
Docker inspect Efe
PS is still in the development phase, not recommended to deploy to the production environment, continue to wait and see ...
This article is from the "Dream to Reality" blog, please be sure to keep this source http://lookingdream.blog.51cto.com/5177800/1788814
Docker Cleanup Command Collection