docker (common commands for mirroring)

Common commands of Docker#

Help command##

docker version    #Display docker version information.

Server: Docker Engine - Community
 Engine:
 Version:19.03.11
 API version:1.40(minimum version 1.12)
 Go version:       go1.13.10
 Git commit:       42e35e61f3
 Built:            Mon Jun  109:12:262020
 OS/Arch:          linux/amd64
 Experimental:false
 containerd:
 Version:1.2.6
 GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
 Version:1.0.0-rc8
 GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
 Version:0.18.0
 GitCommit:        fec3683

docker info       #Display docker system information, including the number of images and containers

Client:
 Debug Mode:false

Server:
 Containers:3
 Running:0
 Paused:0
 Stopped:3
 Images:1
 Server Version:19.03.11
 Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type:true
 Native Overlay Diff:true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
 seccomp
 Profile:default
 Kernel Version:4.18.0-147.8.1.el8_1.x86_64
 Operating System: CentOS Linux 8(Core)
 OSType: linux
 Architecture: x86_64
 CPUs:1
 Total Memory:797.1MiB
 Name: centos8
 ID: L5PV:BLJ6:MJ3P:GLVN:DBYJ:ZWVI:SEHH:MTWJ:7JV6:BF4T:CWND:E2V5
 Docker Root Dir:/var/lib/docker
 Debug Mode:false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental:false
 Insecure Registries:127.0.0.0/8
 Registry Mirrors:
 https://mirror.ccs.tencentyun.com/
 Live Restore Enabled:false

docker command--help #Help command

Mirror command##

docker images #To view all the images on the local host, you can use docker image ls instead

docker search  #Search mirror,Or search on dockerhub.

docker pull #Download image docker image pull

docker rmi #Delete mirror docker image rm
docker images view mirror
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED           SIZE
hello-world           latest              bf756fb1ae65        4 months ago     13.3kB
mysql                 5.7                 b84d68d0a7db        6 days ago       448MB

# Explanation
# REPOSITORY			#Mirrored repository source
# TAG				#Mirrored label(version)---lastest 表示最新version
# IMAGE ID			#Mirror id
# CREATED			#Mirror creation time
# SIZE				#Mirror size

# Optional
Options:-a,--all         Show all images(default hides intermediate images) #List all mirrors
 - q,--quiet       Only show numeric IDs #Only show the id of the mirror
  
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker images -a  #List all mirror details
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker images -aq #List the id of all mirrors
d5f28a0bb0d0
f19c56ce92a8
1 b6b1fe7261e
1 b6b1fe7261e
docker search search mirror
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker search mysql

# - - filter=STARS=3000 #Filter, the number of mirrored STARS searched out is greater than 3000
Options:-f,--filter filter   Filter output based on conditions provided
  - - format string   Pretty-print search using a Go template
  - - limit int       Max number of search results(default25)--no-trunc        Don't truncate output
      
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker search mysql --filter=STARS=3000
NAME        DESCRIPTION         STARS            OFFICIAL        AUTOMATED
mysql       MySQL IS ...9520[OK]                
mariadb     MariaDB IS ...3456[OK]

docker pull download image###

# Download image docker pull image name[:tag][root@iz2zeak7sgj6i7hrb2g862z ~]# docker pull tomcat:88: Pulling from library/tomcat #If you do not write tag, the default is latest
90 fe46dd8199: Already exists   #Hierarchical download: the core joint file system of docker image
35 a4f1977689: Already exists 
bbc37f14aded: Already exists 
74 e27dc593d4: Already exists 
93 a01fbfad7f: Already exists 
1478 df405869: Pull complete 
64 f0dd11682b: Pull complete 
68 ff4e050d11: Pull complete 
f576086003cf: Pull complete 
3 b72593ce10e: Pull complete 
Digest: sha256:0c6234e7ec9d10ab32c06423ab829b32e3183ba5bf2620ee66de866df #Signature security
Status: Downloaded newer image for tomcat:8
docker.io/library/tomcat:8 #Real address

# Equivalent to
docker pull tomcat:8
docker pull docker.io/library/tomcat:8

docker rmi delete mirror###

docker rmi -f mirror id#Delete the mirror with the specified id
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker rmi -f f19c56ce92a8

docker rmi -f $(docker images -aq) #Delete all mirrors
[ root@iz2zeak7sgj6i7hrb2g862z ~]# docker stop $(docker ps -a -q)

Recommended Posts

docker (common commands for mirroring)
Ubuntu common commands
2018-06-14Ubuntu common commands
Docker CE for Ubuntu installation notes