一、镜像的拉取
1、查看本地是否存在目标镜像
[root@localhost /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sonatype/nexus3 latest 640570fd0ff5 3 months ago 642MB
jpress_web latest cc0caef802bb 9 months ago 529MB
tomcat latest 8973f493aa0a 9 months ago 508MB
ubuntu <none> 2ca708c1c9cc 9 months ago 64.2MB
mysql latest b8fd9553f1f0 10 months ago 445MB
portainer/portainer latest 2b4ddf654e1c 11 months ago 77.7MB
rabbitmq 3.7.8-management d69a5113ceae 20 months ago 149MB
java 8 d23bdf5b1b1b 3 years ago 643MB
[root@localhost /]#
2、从远程仓库拉取镜像
一般拉取tag为latest的最新版本
[root@localhost /]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
8559a31e96f4: Pull complete
8d69e59170f7: Pull complete
3f9f1ec1d262: Pull complete
d1f5ff4f210d: Pull complete
1e22bfa8652e: Pull complete
Digest: sha256:21f32f6c08406306d822a0e6e8b7dc81f53f336570e852e25fbe1e3e3d0d0133
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
下载完后,再查看本地镜像,可见Nginx镜像已下载到本地
[root@localhost /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 2622e6cca7eb 4 weeks ago 132MB
sonatype/nexus3 latest 640570fd0ff5 3 months ago 642MB
jpress_web latest cc0caef802bb 9 months ago 529MB
tomcat latest 8973f493aa0a