1, help command
1、docker version
2、docker info
3, focus on mastering: docker --help
2, the mirror command
1, docker, mirror image, the relationship between the container
2、docker images
(1) are listed on the local host mirroring
# Various options Description: the REPOSITORY: represents the repository of the source image TAG: Mirror labels IMAGE ID: ID mirroring CREATED: image creation time SIZE: image size
The same warehouse source can have multiple TAG, on behalf of the warehouse source different versions, we use REPOSITORY: TAG to define different image.
If you do not specify a mirrored version of the label, for example, you only use ubuntu, docker will default ubuntu: latest image
(2) OPTIONS DESCRIPTION
- A: List all the local mirror (image-containing intermediate layer) - Q: Displays the mirror ID. - Digests: mirrored display summary information --no-trunc: display the complete image information
Pastry
Unique primary key
3, docker search a name XXX mirror
(1)dockerhub
website
https://hub.docker.com
One correspondence
(2) docker search [OPTIONS] mirrorname
# The OPTIONS DESCRIPTION: --no- the trunc: Complete image display Description - S: List Favorite Number value not less than the specified image. - Automated: automated build list only type mirror; docker pull a mirror name XXX
Like a number of more than 30 points
Show Details
4, docker pull a mirror name
docker pull mirroring name [: TAG]
docker pull tomcat
Pastry
5, docker rmi XXX mirrored a name ID
(1) Remove Mirror
docker rmi hello-world
is using
(2) delete individual: docker rmi -f ID mirroring
Forced to delete docker rmi -f hello-world
Delete the layer 2
tomcat 400M ???
(3) Remove plurality
docker rmi -f mirror name 1: TAG name Mirror 2: TAG
docker pull hello-world docker pull nginx docker images docker rmi -f hello-world nginx docker images
(4) Delete all
docker rmi -f $ (docker images -qa )
Equivalent to
docker images -qa # past and all
docker rmi -f $(docker images -qa)
6, thinking
Combined with our Git learning experience, I guess whether there will docker commit / docker push? ?
3, container command
There are mirrors to create the container, which is the fundamental premise (download a demo CentOS mirrors)
docker pull centos
docker images
Only 200M
And start a new container
Docker RUN [the OPTIONS] the IMAGE [the COMMAND] [ARG ...]
the OPTIONS DESCRIPTION
start interactive container
.................
docker images
docker run -it xxxx
-i Interactive
-t pseudo-terminal
XXX in a mirror, generating vessel, and into the container centos
ls
pwd
ps -if
Lists all currently running container
There are several containers whale back
PS Docker [the OPTIONS]
the OPTIONS DESCRIPTION
。。。。。。。。。。。。
On a docker ps -l #
docker ps -a # past
docker ps on 3 -n 3 #
docker ps -ql # display only the container number, batch delete container
docker ps
Contrast of each other
Names were randomly assigned
Exit container
two kinds of exit
exit
container stop exit
Exit from the container inside
docker ps
No docker run
docker images centos
docker run -it --name mycentos0111 centos
View running container docker ps
My name is specified
ctrl + P + Q
container does not stop Exit
Leave without closing, run in the background
In the container ctrl + p + q
On the desktop docker ps
State up
docker ps -n 2
----------------
Start container
docker start container vessel name or ID
docker start xxxx
Desktop View docker ps
Restart container
docker restart container or containers ID name
Stop the container
docker stop container vessel name or ID
docker stop xxx slowly flameout, normal shutdown
docker ps
Forcibly stop the container
docker kill container or containers ID name
docker kill xxx unplug
--------------------------------------
To delete a stopped container
docker rm container ID
docker ps -n 2
docker rm xxxx
docker ps -n 2
Forced to delete
docker rm -f xxx
Delete multiple containers
docker rm -f $ (docker ps -a -q)
docker ps -q -a # previous container, all
docker ps -a -q | xargs docker rm
The value passed to a command 1
-------------------------------------
Important to
start the daemon container
docker run -d container name
to view the container logs
docker logs -f -t --tail container ID
* -t is to add a timestamp
* -f to follow the latest log print
* --tail figures show that last how many
view processes running within the container
docker top container ID
to view internal details of the container
docker inspect container ID
into the container and running a command line interactive
docker exec -it container ID bashShell
re-entering the container ID docker attach
these two distinguished
attach directly into the container start command terminals will not start a new process
exec is opening a new terminal in the container, and may start a new process of
copying files from the vessel to the host
docker cp container ID: path to the destination host path within the container
4, a small summary