镜像命令
查看docker的版本信息
[root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker version Client: Docker Engine - Community Version: 19.03.13 API version: 1.40 Go version: go1.13.15 Git commit: 4484c46d9d Built: Wed Sep 16 17:03:45 2020 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.13 API version: 1.40 (minimum version 1.12) Go version: go1.13.15 Git commit: 4484c46d9d Built: Wed Sep 16 17:02:21 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.3.7 GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683 [root@iz2zegwqmvm3ojk5uhtq5oz ~]#
查看docker的系统信息,包括镜像的内容 [root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker info Client: Debug Mode: false Server: Containers: 17 Running: 1 Paused: 0 Stopped: 16 Images: 2 Server Version: 19.03.13 Storage Driver: overlay2 Backing Filesystem: extfs 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: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 3.10.0-957.27.2.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 15.51GiB Name: iz2zegwqmvm3ojk5uhtq5oz ID: MSXX:N4MZ:C5L4:DRVL:NAUL:DOHS:WN7Q:V6OG:ZITU:ROHC:THEZ:CT5T 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://gevb2jt0.mirror.aliyuncs.com/ Live Restore Enabled: false [root@iz2zegwqmvm3ojk5uhtq5oz ~]#
查看镜像信息
[root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest c39a868aad02 11 days ago 133MB centos latest 0d120b6ccaa8 3 months ago 215MB
REPOSITORY:镜像的名字
TAG:镜像的tag值
IMAGE ID :镜像的id
CREATED:镜像创建时间
SIZE:镜像的大小
镜像搜索(搜索mysql镜像,同时留下赞数大于等于300的)
docker search mysql --filter=STARS=300
镜像下载
docker pull name:tag
[root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker pull elasticsearch Using default tag: latest # 如果不写tag值,默认latest latest: Pulling from library/elasticsearch 05d1a5232b46: Pull complete // 分层下载,联合文件系统 5cee356eda6b: Pull complete 89d3385f0fd3: Pull complete 65dd87f6620b: Pull complete 78a183a01190: Pull complete 1a4499c85f97: Pull complete 2c9d39b4bfc1: Pull complete 1b1cec2222c9: Pull complete 59ff4ce9df68: Pull complete 1976bc3ee432: Pull complete 5af49e8af381: Pull complete 42c8b75ff7af: Pull complete 7e6902915254: Pull complete 99853874fa54: Pull complete 596fbad6fcff: Pull complete Digest: sha256:a8081d995ef3443dc6d077093172a5931e02cdb8ffddbf05c67e01d348a9770e Status: Downloaded newer image for elasticsearch:latest docker.io/library/elasticsearch:latest # 镜像的名字,和elasticsearch等价
这两个命令等价:
docker pull elasticsearch
docker pull docker.io/library/elasticsearch:latest
删除镜像
docker rmi -f 名称/镜像id
[root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker rmi -f centos # 删除当个的
Untagged: centos:latest
Untagged: centos@sha256:76d24f3ba3317fa945743bb3746fbaf3a0b752f10b10376960de01da70685fbd
Deleted: sha256:0d120b6ccaa8c5e149176798b3501d4dd1885f961922497cd0abef155c869566
[root@iz2zegwqmvm3ojk5uhtq5oz ~]# docker rmi -f ${docker images -aq} # 删除全部的

浙公网安备 33010602011771号