Docker image and container command collection

Docker image and container command collection


This article records commands for review

Mirror related

Commonly used

View local mirror list

docker images

Search mirror

docker search <imageName>

Get mirror

docker pull <域名>/<namespace>/<repo>:<tag>

View mirror information

docker inspect <imageId>

Delete the mirror (make sure the mirror is not used before deleting)

docker rmi <image>:<tag>

uncommonly used

Create mirror

docker commit <options> <containerId> <repository:tag>

Move out of the mirror

docker save -o <image>.tar <image>:<tag>

Loading image

docker load [--input] <image>.tar 

Upload image

docker push <域名>/<namespace>/<repo>:<tag>

Container related

New container

docker create <imageName>

Create and start the container

docker run <imageName>

Run the container in a daemon state

docker run --name 容器名 -d <image>

Terminate the container

docker stop <containerId>

View running containers

docker ps

View all containers

docker ps -a

Restart the container

docker start <containerId>

Enter the container

docker exec <options> <containerId> <command>

Delete the stopped container

docker rm <containerId>

Delete the running container

docker rm -f <containerId>

Guess you like

Origin blog.csdn.net/L333333333/article/details/104064149