2-Docker command

 

 

 

Docker service-related commands:

# Start docker service 
systemctl Start docker 

# docker stop service 
systemctl STOP docker 

# restart docker service 
systemctl restart docker 

# View docker state 
systemctl Status docker 

# boot docker service 
systemctl enable docker

 

Docker mirroring command:

 Official warehouse: hub.docker.com to find out what is available mirror

# View all local mirroring 
Docker ImagesRF Royalty Free 
# id view all local mirror of 
Docker ImagesRF Royalty Free - q 

# from the network for the required image 
docker search image name 

# Docker from the warehouse to the local pull mirroring 
# Name mirroring the format name: The version number # ### Note the colon, if not specified, the default date 
docker pull the mirror name 

# remove a mirror 
docker rmi mirroring id 
or 
docker rmi mirror name: the version number 
# delete all mirrored 
docker rmi `Docker Image -q` ## in which` `the tab ~ on key

docker container-related commands

# View the running container 
Docker PS
# View all containers
Docker PS -a
# View all containers ID
Docker PS -aq


# Create a container
#docker run parameters
docker run -it --name = c1 ubuntu: 16.04 / bin / bash

Parameter Description:
• -i: Keep container running normally used in conjunction with -t.. After adding -it these two parameters, the container is created automatically after entering the container, after exiting the container, the container is automatically closed.
• -t: run container terminal mode. To reassign a container terminal input side, typically with - used simultaneously I.
• -d: Run vessel daemon (background) mode. Container is running in the background, you need to use docker exec into the container. After exiting the container is not closed.

docker exec -it c1 /bin/bash

Container • -it created commonly referred to as interactive, containers -id create commonly referred to as the guardian of containers
• --name: Create a container named

• ubuntu: 16.04: mirror used

• / bin / bash initialization commands into the container (not the default for this)

 

Exit # container 
# container terminal at 
Exit 

# launch container
docker Start c1

# closed container
docker STOP c1

# delete container
#docker rm container iD or name
docker RM c1

# delete all containers
docker docker RM `PS -aq`

# view container information
docker inspect c1

 

Guess you like

Origin www.cnblogs.com/long5683/p/12459974.html