Learning docker must master 15 docker command

table of Contents

15 docker commonly used commands

1. docker –-version
docker --version

This command is used to get the currently installed version of docker

2. docker pull
docker run -it -d <image name>

This command is used to drive away the docker from the warehouse (hub.docker.com) Mirror

3. docker run
docker run -it -d <image name>

This command creates a docker docker container from the mirror

4. docker ps
docker ps

This command is used to view docker container running

5. docker ps -a
docker ps -a

This command is used to view all the running and has ended the docker container

6. docker exec
docker exec -it <container id> bash

This command is used to enter the interior of the container docker running

7. docker stop
docker stop <container id>

This command is used to stop a docker container

8. docker kill
docker kill <container id>

This command is executed immediately terminated by stopping the container. docker killAnd docker stopthe difference between that docker stopis normally closed docker container and docker killis forced to kill docker process

9. docker commit
docker commit <conatainer id> <username/imagename>

This command will create your new docker edited image on your local machine

10. docker login
docker login

This is a command used to log docker hub

11. docker push
docker push <username/image name>

This command corresponding mirrored to push docker hub (provided that you have registered docker hub, see docker login)

12. docker images
docker images

This command lists all locally stored docker mirror

13. docker rm
docker rm <container-id>

This command will delete the corresponding docker container, container-idyou can go to docker ps -aview

14. docker rmi
 docker rmi <image-id>

This command removes a local mirror of the docker, image-idyou can go to docker imagesview

15. docker build
docker build <path to docker file>

This command is used to build the image file from the specified docker

Guess you like

Origin www.cnblogs.com/jasondayee/p/12095791.html