阿里云私有镜像仓
地址: https://cr.console.aliyun.com/cn-shenzhen/instances/repositories
过程很简单, 首先申请开通阿里云私有镜像仓, 然后使用此账号登录即可, 比如:
$ docker login --username=xxx@qq.com registry.cn-shenzhen.aliyuncs.com
然后创建一个命名空间:
将本地的镜像重新打标签并上传即可, 比如:
docker tag [ImageId] registry.cn-shenzhen.aliyuncs.com/quanzaiyu/kubernetes-dashboard-amd64:[镜像版本号]
docker push registry.cn-shenzhen.aliyuncs.com/quanzaiyu/kubernetes-dashboard-amd64:[镜像版本号]
同时, 还可以使用镜像加速服务:
上传到私有仓库的镜像:
Registry
Docker 注册服务器
下载 registry 镜像, 并创建容器
$ docker pull registry # 下载Docker注册服务器镜像
$ docker run -d \
-p 5000:5000 \
--name server-registry \
-v /tmp/registry:/tmp/registry \
registry # 运行Docker注册服务器
将私有仓库上传到Docker注册服务器
首先,得对需要上传的镜像打标签,并指定Docker注册服务器的地址
docker tag centos:latest localhost:5000/centos:1.0
然后,将打了标签的镜像上传到Docker注册服务器:
$ docker push localhost:5000/centos:1.0
The push refers to a repository [localhost:5000/centos]
f972d139738d: Pushed
1.0: digest: sha256:dc29e2bcceac52af0f01300402f5e756cc8c44a310867f6b94f5f7271d4f3fec size: 529
注意,这里由于是在一台机子上演示的,所以意义不大,通常我们会在另一台机器上开一个Docker注册服务器。将镜像上传到另一个机器上, 这里的 localhost:5000 就是另一台机器的镜像仓库地址。
拉取私有仓库镜像
$ docker pull localhost:5000/centos:1.0
Trying to pull repository localhost:5000/centos ...
1.0: Pulling from localhost:5000/centos
Digest: sha256:dc29e2bcceac52af0f01300402f5e756cc8c44a310867f6b94f5f7271d4f3fec
Status: Image is up to date for localhost:5000/centos:1.0
# 如果没有指定标签,而指定镜像又没有latest标签,则报错
$ docker pull localhost:5000/centos
Using default tag: latest
Trying to pull repository localhost:5000/centos ...
Pulling repository localhost:5000/centos
Error: image centos:latest not found