docker-compose 搭建docker私服 registry笔记
[root@MiWiFi-R3P-srv ~] cd /usr/local/docker/registry/ [root@MiWiFi-R3P-srv registry] ls data docker-compose.yml [root@MiWiFi-R3P-srv registry] cat docker-compose.yml version: '3.1' services: registry: privileged: true image: registry restart: always container_name: registry ports: - 5000:5000 volumes: - /usr/local/docker/registry/data:/var/lib/registry web: image: konradkleine/docker-registry-frontend:v2 links: - registry:docker-registry.com restart: always ports: - 80:80 environment: - ENV_DOCKER_REGISTRY_HOST=docker-registry.com - ENV_DOCKER_REGISTRY_PORT=5000 [root@MiWiFi-R3P-srv registry] docker-compose up -d
docker-registry.com 和 机器ip在我的局域网环境做了映射,没做的话可以直接用ip
配置私服地址
在 /etc/docker/daemon.json 文件,添加 “insecure-registries”: [“docker-registry.com:5000”]
[root@MiWiFi-R3P-srv registry] cat /etc/docker/daemon.json { "registry-mirrors": ["http://hub-mirror.c.163.com"], "insecure-registries": ["docker-registry.com:5000"] }{}
重启一下docker
[root@MiWiFi-R3P-srv registry] systemctl restart docker
推送到私服
docker tag mysql:5.7.22 docker-registry.com:5000/mysql:5.7.22 docker push docker-registry.com:5000/mysql:5.7.22
下载镜像
docker pull docker-registry.com:5000/mysql:5.7.22
权限坑
权限问题可能导致上传不上去,没有提示的,真坑
原文链接:https://blog.csdn.net/weixin_38287709/article/details/105314855
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END