简体   繁体   中英

What to write in docker-compose.yml for self mantained docker registry

I have next progress

version: '3'
services:
  registry:
    restart: always
    image: registry:2
    ports:
      - 443:5000
    environment:
      REGISTRY_HTTP_TLS_CERTIFICATE: /certs/fullchain.crt
      REGISTRY_HTTP_TLS_KEY: /certs/privkey.key
    volumes:
      - /path/data:/var/lib/registry
      - /etc/letsencrypt/live/registry.my-site.com:/certs

Works fine, but how should i pass htpasswd ?

First need to create htpasswd file with -B

sudo htpasswd -cbB .htpasswd <login> <password>

then add to docker-compose.yml

environment:
  REGISTRY_AUTH: htpasswd
  REGISTRY_AUTH_HTPASSWD_PATH: /auth/.htpasswd
  REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
  - <path to folder with .htpasswd>:/auth

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM