ubuntu 搭建私有仓库

ubuntu docker 安装

sudo apt-get update

sudo apt-get install docker.io -y

1、首先拉取私有仓库镜像到本地

docker pull registry

2、然后启动该镜像的容器,默认使用5000端口

docker run -id --name=registry -port 5000:5000 registry

3、打开浏览器 输入地址 http://私有仓库服务器地址(ip):端口号/v2/_catalog,如果能看到 {"repositories":[]} ,则代表私有仓库建立成功

4、在另外一台客户机上centos或者其他(将私有仓库地址设为安全可信任)

vim /etc/docker/daemon.json

{"insecure-registries":["私有仓库服务器ip:5000"]}

5、重启docker 服务

systemctl restart docker

docker start registry

6、上传镜像到私有仓库

docker  tag 镜像名称:版本号(最新版可省略版本号) 私有仓库服务器ip:端口号/镜像名称:镜像版本号

docker  push  私有仓库服务器ip:端口号/镜像名称:镜像版本号

查看“http://私有仓库服务器地址(ip):端口号/v2/_catalog”,是否包含了上传的镜像,包含则上传成功

7、拉取镜像

docker pull 私有仓库服务器ip:端口号/镜像名称:镜像版本号

原文地址:https://www.cnblogs.com/yiyanwei/p/12865104.html