一.下载镜像

docker pull  镜像名字

二.查看本地镜像

docker images

三.修改本地镜像名称:

docker tag 镜像ID 用户名称/镜像源名(repository name):新的标签名(tag)

四.删除本地镜像

docker rmi 镜像id

五.分享镜像:

1.登录docker Hub
docker login

2.分享镜像
docker push 用户名/库名:标签
docker push<hub-user>/<repo-name>:<tag>
3.登出docker Hub
docker logout

要发布到私有Registry中的镜像,在镜像命名中需要带上Registry的域名(如果非80端口,同时需要带上端口号)比如:

docker push dockerhub.yourdomain.com:443/hello.demo.kdemo:v1.0

六.查看容器/镜像的信息

docker inspect

七.将指定镜像保存成 tar 归档文件

docker save
docker save -o ubuntu14.04.tar ubuntu:14.04
将指定镜像保存成 tar 归档文件, docker load 的逆操作。保存后再加载(saved-loaded)的镜像不会丢失提交历史和层,可以回滚。
-o, --output=      Write to an file, instead of STDOUT 输出到的文件

从 tar 镜像归档中载入镜像,docker save 的逆操作

docker load
docker load -i ubuntu14.04.tar
从 tar 镜像归档中载入镜像, docker save 的逆操作。保存后再加载(saved-loaded)的镜像不会丢失提交历史和层,可以回滚。
上面命令的意思是将 ubuntu14.04.tar 文件载入镜像中。
参数:  -i, --input=       Read from a tar archive file, instead of STDIN 加载的tar文件

八.显示一个镜像的历史

docker history image_name

一、推荐优先使用的镜像源(2025年3月确认可用)

​https://docker.1ms.run

支持主流Linux系统(Ubuntu/Debian/CentOS)及群晖NAS,提供分钟级同步和镜像搜索功能。

​https://docker.xuanyuan.me

含中文文档和群晖NAS配置指南,支持DockerHub镜像代理。

​https://mirror.ccs.tencentyun.com

腾讯云官方镜像,企业级稳定性保障,适合生产环境。

​https://docker.linkedbus.com

多节点代理服务,支持镜像分层缓存加速。

二、其他可用镜像源

​通用加速站:
https://dockerpull.org(长期稳定)、https://docker.foreverlink.lovehttps://func.ink
​学术机构镜像:
http://mirrors.ustc.edu.cn(中科大镜像站)、http://mirror.azure.cn(Azure镜像)
​特色服务:
https://atomhub.openatom.cn(仅336个基础镜像,适合轻量级场景)

三、配置方法(以Linux为例)
​修改配置文件:

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": [
    "https://docker.1ms.run",
    "https://docker.xuanyuan.me",
    "https://mirror.ccs.tencentyun.com"
  ]
}
EOF

​重启服务生效:

sudo systemctl daemon-reload && sudo systemctl restart docker