有时候需要共享镜像或者习惯使用自己定义的镜像,可以注册私有仓库,国内推荐使用阿里云
步骤:
1.登录阿里云容器镜像服务:
https://cr.console.aliyun.com/cn-hangzhou/repositories
2.将镜像推送到阿里云
# 登录阿里云的docker仓库
$ sudo docker login --username=[用户名] registry.cn-lindsey.aliyuncs.com
# 创建指定镜像的tag,归入某个仓库
$ sudo docker tag [镜像ID] registry.cn-lindsey.aliyuncs.com/lindsey/myboot:[镜像版本号]
# 讲镜像推送到仓库
$ sudo docker push registry.cn-lindsey.aliyuncs.com/lindsey/myboot:[镜像版本号]
3.拉取镜像
docker pull registry.cn-lindsey.aliyuncs.com/lindsey/myboot:v1