Docker 官方提供了一个搭建私有仓库的镜像 registry ,只需把镜像下载下来,运行容器并暴露5000端口,就可以使用了,简单记录一下
步骤1,拉取镜像
[root@localhost ~]# docker pull registry
步骤2,创建容器运行
[root@localhost ~]# docker run -di --name=registry -p 5000:5000 registry
步骤3,配置docker仓库地址
[root@localhost ~]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://fl791z1h.mirror.aliyuncs.com"],
"insecure-registries":["192.168.137.110:5000"]
}
步骤4,重启docker
[root@localhost ~]# systemctl restart docker
步骤5,推送docker镜像到私有仓库
[root@localhost ~]# docker push 192.168.137.110:5000/countgame
步骤6,查看docker仓库信息
-
显示所有仓库的镜像
http://192.168.137.110:5000/v2/_catalog
-
显示单个镜像的所有版本
http://192.168.137.110:5000/v2/countgame/tags/list
-
docker私有仓库api
docker 私有仓库官网:https://docs.docker.com/registry/spec/api/#detail
springboot项目推送到docker私有仓库:https://blog.csdn.net/qq_21187515/article/details/90302026
参考: Docker私有仓库的安装和操作