1. create htpasswd
docker run --rm --entrypoint htpasswd registry:2 -Bbn username password > htpasswd docker run --rm --entrypoint htpasswd registry:2 -Bbn test test > htpasswd htpasswd file inside have two records: username & test
2. create registry_config.yml
version: 0.1 log: fields: service: registry storage: delete: enabled: true cache: blobdescriptor: inmemory filesystem: rootdirectory: /var/lib/registry http: addr: :5000 headers: X-Content-Type-Options: [nosniff] Access-Control-Allow-Origin: ['*'] Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE'] Access-Control-Allow-Headers: ['Authorization'] Access-Control-Max-Age: [1728000] Access-Control-Allow-Credentials: [true] Access-Control-Expose-Headers: ['Docker-Content-Digest'] auth: htpasswd: realm: basic-realm path: /etc/docker/registry/htpasswd Access-Control-Allow-Origin can change you want.
...