进容器查询版本号:
docker exec registry registry --version
新建用户名和密码:
docker run --entrypoint htpasswd registry:2.4.1 -Bbn felix felix >> /opt/registry-var/auth/htpasswd
运行registry命令:
docker run -d -P -it -p 5000:5000 \
--restart=always \
--name registry \
-v /home/docker/registry:/var/lib/registry \
-v /home/docker/certs:/etc/docker/certs \
-v /home/docker/registry/config/config.yml:/etc/docker/registry/config.yml \
-v /home/docker/registry/auth/:/auth/ \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/etc/docker/certs/192.168.1.52.crt \
-e REGISTRY_HTTP_TLS_KEY=/etc/docker/certs/192.168.1.52.key \
-e REGISTRY_AUTH=htpasswd \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
registry