Kill all the containers that are running Docker kill $ (Docker ps-a-Q)
Remove all stopped containers (Docker RM does not have the-f parameter, the running container will not be deleted) Docker RM $ (Docker ps-a-Q)
Delete all non-dangling tagged images docker rmi $ (Docker images-q-F Dangling=true)
If you want to delete untagged images, which is the image with ID <None>, you can use
Docker RMI $ (Docker images | grep "^<none>" | awk "{PRINT $ 3} ")
Remove all mirrors Docker rmi $ (Docker images-q)
Create aliases for these commands # ~/.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