一、获取镜像
通常情况下,描述一个镜像需要包括 “NAME” + “TAG” 的信息。
如果不显示的指定TAG,则默认会选择latest标签,这会下载仓库中最新版本的镜像。
严格的来说,镜像的名称中还应该添加仓库地址(即 registry,注册服务器)作为前缀,若该前缀省略,则默认使用官方的Docker Hub服务。
docker默认镜像拉取地址为国外仓库下载速度较慢,则会报错“net/http: TLS handshake timeout”,建议设置registry mirrors为国内的服务器地址。
在docker服务启动配置中增加 --registry-mirror=proxy_URL来指定代理服务器地址(如 https://registry.docker-cn.com)。
docker image pull --help
Usage: docker image pull [OPTIONS] NAME[:TAG|@DIGEST]
Pull an image or a repository from a registry
Options:
-a, --all-tags Download all tagged images in the repository
--disable-content-trust Skip image verification (default true)
-q, --quiet Suppress verbose output
# REGISTRY:服务器地址、NAME:镜像名称、TAG:镜像标签
docker [image] pull REGI