Kill all the containers that are running
Copy Code code as follows:
Docker kill $ (Docker ps-a-Q)
Delete all containers that have stopped
Copy Code code as follows:
Docker RM $ (Docker ps-a-Q)
Delete all mirrors that are not labeled dangling
Copy Code code as follows:
Docker RMI $ (Docker images-q-F Dangling=true)
Remove all mirrors
Copy Code code as follows:
Docker RMI $ (Docker images-q)
Create aliases for these commands
Copy Code code as follows:
# Kill all the containers that are running.
Alias Dockerkill= ' Docker kill $ (Docker ps-a-Q) '
# Delete all containers that have been stopped.
Alias Dockercleanc= ' Docker rm $ (Docker ps-a-Q) '
# Remove all unread mirrors.
Alias Dockercleani= ' Docker RMI $ (Docker images-q-f dangling=true) '
# Delete all containers that have been stopped and mirrors that are not tagged.
Alias dockerclean= ' Dockercleanc | | True && Dockercleani '
Attached Docker common commands
Docker version #查看版本
Docker search tutorial# available docker mirrors
Docker Pull Learn/tutorial #下载镜像
Docker run learn/tutorial echo "Hello word" #在docker容器中运行hello world!
Docker run learn/tutorial apt-get install-y ping# Install a new program in the container
Save Mirror
First use the Docker ps-l command to obtain the ID of the container after the ping has been installed. Then save the image as a learn/ping.
Tips:
1. Run Docker commit to view the list of arguments for the command.
2. You need to specify the ID of the storage container to be submitted. (translator: obtained by Docker ps-l command)
3. There is no need to copy the full ID, usually the beginning of the three to four letters can be distinguished. (Translator: Very similar to git inside version number)
The correct command:
Docker commit 698 Learn/ping
Running a new mirror
Docker Run lean/ping Ping www.google.com
To check for mirroring in a run
Now that you have run a Docker container, let's look at the container that is running.
Use the Docker PS command to view all the running container lists and use the Docker inspect command to view more detailed information about a container.
Goal:
Locate 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 section of the mirror ID, and you do not need the 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 ...