Docker私有仓库搭建记录
安装运行 docker-registry
1 | docker run -d --name registry --restart=always \ |
使用本地仓库(以mysql为例)
生成mysql的tag
1
docker tag mysql:5.7.23 registry:5000/mysql:5.7.23
将mysql推入私有仓库
1
docker push registry:5000/mysql:5.7.23
如果出现如下提示,参考备注(2)
The push refers to repository [registry:5000/mysql]
Get https://registry:5000/v2/: http: server gave HTTP response to HTTPS client从本地仓库获取镜像
1
2
3
4docker run --restart=always --name mysql-prod \
-v /data/docker/instance/mysql/3/db:/var/lib/mysql \
-v /data/docker/instance/mysql/3/conf:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=123456 -d -p 10.12.64.60:3306:3306 registry:5000/mysql:5.7.23
备注
registry:5000表示HOST:PORT格式
可以在**/etc/hosts**中配置registry对应的IP地址
编辑**/etc/docker/daemon.json**添加
1
{"insecure-registries":["registry:5000"]}
查看私有仓库镜像
1
curl -XGET registry:5000/v2/_catalog