服务器 发布日期:2024/11/2 浏览次数:1
本文计划使用3条命令来运行一个Docker registry私服,其实很简单
环境准备:
docker 1.11.2
compose文件docker-compose.yml
version: '2' services: registry: image: registry:2.5.1 hostname: registry ports: - "5000:5000" environment: - TZ="Asia/Shanghai" - "REGISTRY_AUTH=htpasswd" - "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" - REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd - REGISTRY_HTTP_TLS_CERTIFICATE=/certs/crtfile.crt - REGISTRY_HTTP_TLS_KEY=/certs/keyfile.key volumes: - /home/soft/registry/auth:/auth - /home/soft/registry/certs:/certs networks: default: external: name: mynet
第一条命令:
docker pull registry:2.5.1
第二条命令:
docker run --entrypoint htpasswd registry:2.5.1 -Bbn testuser testpassword > /home/soft/registry/auth/htpasswd
第三条命令:
docker-compose up -d
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!