描述
从镜像仓库中拉取或者更新指定镜像
用法
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
--all-tags , -a:下载所有标签镜像
--disable-content-trust:跳过验证,默认值true
--platform:体验版(daemon)API 1.32+ 多平台时进行选择
--quiet , -q:静默输出
实例
从公共仓库拉取镜像
$ docker pull debian Using default tag: latest latest: Pulling from library/debian fdd5d7827f33: Pull complete a3ed95caeb02: Pull complete Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa Status: Downloaded newer image for debian:latest
指定标签下载镜像
$ docker pull debian:jessie jessie: Pulling from library/debian fdd5d7827f33: Already exists a3ed95caeb02: Already exists Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e Status: Downloaded newer image for debian:jessie
查看下载的镜像
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE debian jessie f50f9524513f 5 days ago 125.1 MB debian latest f50f9524513f 5 days ago 125.1 MB
通过Digist下载指定镜像
$ docker pull ubuntu:14.04 14.04: Pulling from library/ubuntu 5a132a7e7af1: Pull complete fd2731e4c50c: Pull complete 28a2f68d1120: Pull complete a3ed95caeb02: Pull complete Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 Status: Downloaded newer image for ubuntu:14.04
可以看到ubuntu:14.04的digist是
sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
$ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu 5a132a7e7af1: Already exists fd2731e4c50c: Already exists 28a2f68d1120: Already exists a3ed95caeb02: Already exists Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
从不同仓库下载镜像
$ docker pull myregistry.local:5000/testing/test-image
Docker默认使用https://协议下载镜像,除非仓库允许非安全协议
下载多标签镜像
$ docker pull --all-tags fedora Pulling repository fedora ad57ef8d78d7: Download complete 105182bb5e8b: Download complete 511136ea3c5a: Download complete 73bd853d2ea5: Download complete .... Status: Downloaded newer image for fedora
可以使用docker images fedora可看下载到的镜像,包括fedora的所有标签
$ docker images fedora REPOSITORY TAG IMAGE ID CREATED SIZE fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB fedora 20 105182bb5e8b 5 days ago 372.7 MB fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB fedora latest 105182bb5e8b 5 days ago 372.7 MB
取消下载镜像
使用ctrl-c取消下载镜像
$ docker pull fedora Using default tag: latest latest: Pulling from library/fedora a3ed95caeb02: Pulling fs layer 236608c7b546: Pulling fs layer ^C