白云岛资源网 Design By www.pvray.com

本文计划使用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 

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com