- 生成密码
使用htpasswd来生成registry的密码
mkdir /registry/pwd/
docker run --entrypoint htpasswd registry -Bbn testuser testpassword > /registry/pwd/htpasswd
- 运行带有验证的registry
docker run -d -v /registry/pwd/:/auth/ -v /dockerdata/registry:/var/lib/registry -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -p 5000:5000 --restart=always --privileged=true --name docker-registry4 registry:latest
- 登陆到仓库
docker login 172.16.4.104:5000
- 推送镜像到仓库
docker tag ubuntu 172.16.4.104:5000/ubuntu1:1
docker push 172.16.4.104:5000/ubuntu1:1
- web管理端
http://172.16.4.104:8081