1、上传镜像到公有仓库
1)、登录https://hub.docker.com/ 创建账号
2)、docker images
找一个小一点的images,如hello-world
3)、打上tag
docker tag hello-world:latest larry003/hello-world:latest
larry003 是docker hub上的用户名
4)登录docker hub
docker login
5)将镜像上传
docker push larry003/hello-world:latest
2、私有仓库
1)打开 https://hub.docker.com, 搜索registry
2) 下载registry版本2
docker pull registry:2
3) 运行镜像
docker run -d -p 5000:5000 registry:2
4) 打上tag
docker tag hello-world:latest localhost:5000/hello-world:latest
5) 推送镜像
docker push localhost:5000/hello-world:latest
总结:这样私有仓库就创建起来了。
缺点:生产环境的单点问题,如果这条服务器故障了,其它服务器很难接管过来。
没有操作界面。
3、harbor
harbor解决了registry的问题
在github上下载harbor https://github.com/goharbor/harbor
下载1.2.2版本 harbor-offline-installer-v1.2.2.tgz
https://github.com/goharbor/harbor/releases/tag/v1.2.2