安装本地化docker registry,使其他机器能够发布容器

sudo docker pull registry:latest

docker run -d -p 5000:5000 --name registry registry:latest

 http://localhost:5000/v2/_catalog, 检查运行成功

此时在子机3号上访问:

http://192.168.170.130:5000/v2/_catalog, 

 登陆远程仓库,如果远程仓库没有配置authentication 验证登陆直接把image tag为 docker tag imagename registry:500/imagename, 然后docker push即可推送到registry, 否则要配置安全登陆需要login,要用htpasswd来自apache2-utils 包的htpasswd生成密钥再登陆:

 

sudo mkdir /etc/auth && mv ./htpasswd /etc/auth/

 

,

然后在worker机上要配置使http可以登陆到registry机仓库:

 worker机访问docker registry进行登陆:

 

 

登陆成功后要推送:

先将本地image tag: docker tag hello-world 192.168.170.130:5000/hello-world:latest

然后推送: docker push 192.168.170.130:5000/hello-world:latest, 就会推送成功

 

 查看已经推送的镜像:

 

posted @ 2023-11-11 17:46  calochCN  阅读(20)  评论(0编辑  收藏  举报