Docker Basics
I’m learning Docker Some common commands recorded on the road
-
Find image :docker search Mirror name
-
Pull the mirror image :docker pull Mirror name
-
start-up docker service :sudo service docker start
-
see docker state :systemctl status docker
-
Start the mirror :docker run Mirror name
-
Enter the running container :docker exec -it Container name
-
View the currently running container :docker ps
-
See the last container created :docker ps -l
-
List all containers ID:docker ps -aq
-
See all running or not running containers :docker ps -a
-
Add :docker container ls -l/all
-
A container that stops running :docker stop Containers id/name
-
Restart terminated container :docker start Containers id
-
Restart the running container :docker restart Containers id
-
Delete docker In the container :docker rm Containers id
-
Delete docker All the containers in :docker rm ‘docker ps -a -q’ -f
-
Remove the data volume while deleting the container :docker rm -v Containers id
-
See what images there are :docker images
-
Delete docker In the mirror :docker rmi Mirror image id
-
Delete docker All the images in :docker rmi $(docker images -q)
-
Delete the container first , Delete the image again
-
See mapping container mapping port :docker port Containers id/name
-
Check the standard output inside the container :docker logs Containers id/name
-
View the standard output of the real-time log inside the container :docker logs -f Containers id/name
-
View the processes running inside the container :docker top Container name
-
Mark image :docker tag Mirror name The new mirror name of the tag
-
restart docker: service docker restart
-
Submit image :docker push Mirror name or : docker push Mirror name : Tag name notes : The image name must be docker account number / Mirror name : Tag name , If there is no tag name default latest, You can also add a tag name when you submit
-
Export container :docker export Containers id > file name ( Export container snapshot to local file )
-
Import container :docker import – Snapshot filename …
-
Creating a data volume :docker volume create Data volume name
-
View all data volumes :docker volume ls
-
View the specified data volume information :docker volume inspect Data volume name
-
View container information :docker inspect Container name data volume information in its “Mounts”Key below
-
Delete data volume :docker volume rm Data volume name ( Before deleting a data volume, you need to delete the container using the data volume )
-
Delete a data volume that has no master :docker volume prune
Some execute commands with id And the name , We need to try more .
If there is a mistake , Welcome to point out .