用Registry_container_搭建_docker_registry_私服手把手带截图教程
Last updated
Last updated
mkdir -p certs
openssl req \
-newkey rsa:4096 -nodes -sha256 -keyout certs/erato.key \
-addext "subjectAltName = DNS:eratoregistry.com" \
-x509 -days 365 -out certs/erato.crt$ mkdir auth
$ docker run \
--entrypoint htpasswd \
httpd:2 -Bbn erato 123456 > auth/htpasswdregistry:
restart: always
image: registry:2
ports:
- 5000:5000
environment:
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/erato.crt
REGISTRY_HTTP_TLS_KEY: /certs/erato.key
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- /erato/data:/var/lib/registry
- /erato/certs:/certs
- /erato/auth:/authdocker compose up -dmkdir -p /etc/docker/certs.d/eratoregistry.com/
cp erato.crt /etc/docker/certs.d/eratoregistry.com/ca.crtdocke login eratoregistry.comdocker pull alpine:3.14
docker tag alpine:3.14 eratoregistry.com/alpine:3.14
docker push eratoregistry.com/alpine:3.14docker pull eratoregistry.com/alpine:3.14