搜索镜像
格式: docker search 关键字
#搜索nginx的镜像
[root@localhost ~]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 16974 [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS… 169
bitnami/nginx Bitnami nginx Docker Image 131 [OK]
ubuntu/nginx Nginx, a high-performance reverse proxy & we… 52
bitnami/nginx-ingress-controller Bitnami Docker Image for NGINX Ingress Contr… 18 [OK]
rancher/nginx-ingress-controller 10
clearlinux/nginx Nginx reverse proxy server with the benefits… 4
ibmcom/nginx-ingress-controller Docker Image for IBM Cloud Private-CE (Commu… 4
bitnami/nginx-ldap-auth-daemon 3
rancher/nginx 2
bitnami/nginx-exporter 2
vmware/nginx 2
rancher/nginx-ingress-controller-defaultbackend 2
circleci/nginx This image is for internal use 2
vmware/nginx-photon 1
rapidfort/nginx RapidFort optimized, hardened image for NGINX 1
bitnami/nginx-intel 1
kasmweb/nginx An Nginx image based off nginx:alpine and in… 1
wallarm/nginx-ingress-controller Kubernetes Ingress Controller with Wallarm e… 1
ibmcom/nginx-ingress-controller-ppc64le Docker Image for IBM Cloud Private-CE (Commu… 0
rancher/nginx-conf 0
rancher/nginx-ssl 0
continuumio/nginx-ingress-ws 0
rancher/nginx-ingress-controller-amd64 0
ibmcom/nginx-ppc64le Docker image for nginx-ppc64le 0
获取镜像
格式: docker pull 仓库名称[:标签]
如果下载镜像时不指定标签,则默认会下载仓库中最新版本的镜像,即选择标签为 latest 标签。
#拉取镜像nginx
[root@localhost ~]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
42c077c10790: Pull complete
62c70f376f6a: Pull complete
915cc9bd79c2: Pull complete
75a963e94de0: Pull complete
7b1fab684d70: Pull complete
db24d06d5af4: Pull complete
Digest: sha256:2bcabc23b45489fb0885d69a06ba1d648aeda973fae7bb981bafbb884165e514
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
[root@localhost ~]#
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 0e901e68141f 3 weeks ago 142MB
[root@localhost ~]##拉取soscscs仓库中myapp镜像的v1标签
[root@localhost ~]# docker pull soscscs/myapp:v1
v1: Pulling from soscscs/myapp
550fe1bea624: Pull complete
af3988949040: Pull complete
d6642feac728: Pull complete
c20f0a205eaa: Pull complete
438668b6babd: Pull complete
bf778e8612d0: Pull complete
Digest: sha256:9eeca44ba2d410e54fccc54cbe9c021802aa8b9836a0bcf3d3229354e4c8870e
Status: Downloaded newer image for soscscs/myapp:v1
docker.io/soscscs/myapp:v1
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 0e901e68141f 3 weeks ago 142MB
soscscs/myapp v1 d4a5e0eaa84f 4 years ago 15.5MB
[root@localhost ~]#
查看镜像信息
镜像下载后存放在 /var/lib/docker
#镜像文件存放在 /var/lib/docker 目录中
[root@localhost ~]# cd /var/lib/docker/
[root@localhost docker]# ls
buildkit image overlay2 runtimes tmp volumes
containers network plugins swarm trust
---------------------------------------------------------------------------------
#image 存放镜像信息
#overlay2 镜像底层文件相关信息
#containers 存放容器信息
---------------------------------------------------------------------------------#查看下载的镜像文件信息
[root@localhost ~]# cat /var/lib/docker/image/overlay2/repositories.json#查看下载到本地的所有镜像信息
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest f8f4ffc8092c 8 days ago 133MB#REPOSITORY: 镜像所属仓库
#TAG: 镜像的标签信息,标记同一个仓库中的不同镜像
#IMAGE ID :镜像的唯一ID号,唯一标识一个镜像
#CREATED: 镜像创建时间
#SIZE: 镜像大小