1. Check the ip address
ip addr
2. Start docker
systemctl start docker
systemctl status docker
3. View docker version information
docker version
4. Instance view docker system information
docker info
5. Restart
shut down and start again
systemctl restart docker
6.Docker help command
docker --help
7. View all current docker images
docker images
-a is equivalent to all to view all local mirrors, the default is -a
docker images -a
-q returns all mirror ids
docker images -q
8. Search mirror
Before downloading, you can see if there is a corresponding mirror
docker search 镜像名称
docker search jdk
The parameter limit displays the specific number
docker search 镜像名称 --limit n(数字)
docker search --limit 5 redis
9. The magical effect of help
docker search --help
10. Download mirror
Download jdk, by default, there is no version number, the default is latest latest
docker pull java
After adding the version number, you can specify the version and download a specific version
docker pull redis:6.0.8
11. Delete a mirror file
Can be deleted by image id or name
Delete by adding a tag to the image name
docker rmi java:8
docker rmi java:latest
Delete by mirror id
docker rmi d23bdf5b1b1b
12. Delete multiple images at once
Delete multiple images at once, separated by spaces
docker rmi 镜像id1 镜像id2
docker rmi d23bdf5b1b1b d23bdf5b1b22
docker rmi redis:latest redis:6.0.8
13. Delete all images at once
Subquery similar to mysql
docker rmi $(docker images -q)
-f force delete
docker rmi -f $(docker images -q)
14. Container start
docker run image name
docker run hello-world
If something to run does not exist, it will be downloaded
docker run redis:6.0.8
-d background daemon (referring to directly create a container as a background process)
docker run -d redis:6.0.8
15. Rename after closing the container
stop running container
docker stop bdushuskf
16. Container Naming
--name give the container a new name, if not then assign a random one
docker run -d --name="myredis" redis:6.0.8
17. Display currently running docker containers
docker ps
18. Interactive operation of ubuntu system through pseudo-terminal
-i interactive
-t returns a pseudo-terminal
-it returns an interactive pseudo-terminal
docker run -it ubuntu
19. Exit the pseudo-terminal and close the container
exit
20. Exit the pseudo-terminal without closing the container
快捷键ctrl+p+q
21. Delete the container
The container cannot be deleted during operation.
Docker rm container id
docker rm 73655ea903d4
Shut down before deleting the container
docker stop 73655ea903d4
docker rm 73655ea903d4
-f Forcefully delete the container
docker rm -f 73655ea903d4
I am learning relevant knowledge, please correct me if I make mistakes