下载 Docker 镜像的基本命令是 docker pull
:
docker pull [选项] [Docker Registry地址]<仓库名>:<标签>
下载最新版镜像 (默认标签为 latest):
docker pull nginx
下载指定版本的镜像:
docker pull nginx:1.21.6
从私有仓库下载镜像:
docker pull myregistry.example.com/myimage:tag
下载官方镜像 (官方镜像通常没有前缀):
docker pull ubuntu
下载第三方镜像 (通常带有用户名/组织名前缀):
docker pull bitnami/redis
--platform
: 指定平台架构 (如 linux/amd64, linux/arm64)--all-tags
: 下载仓库中的所有标签的镜像 (不推荐,会下载大量数据)下载完成后,可以使用以下命令查看本地镜像:
docker images
如果下载速度慢,可以配置国内镜像加速器:
/etc/docker/daemon.json
文件json
{
"registry-mirrors": ["https://<your-id>.mirror.aliyuncs.com"]
}
bash
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo
或把用户加入 docker 组需要下载特定镜像的帮助吗?我可以提供更具体的指导。