Skip to content

Instantly share code, notes, and snippets.

@includeamin
Last active December 9, 2019 22:54
Show Gist options
  • Save includeamin/44886a51fa72639ecfc69343aebeae82 to your computer and use it in GitHub Desktop.
Save includeamin/44886a51fa72639ecfc69343aebeae82 to your computer and use it in GitHub Desktop.
docker registry with authentication
docker run -d \
  -p 5000:5000 \
  --restart=always \
  --name registry \
  -v "$(pwd)"/auth:/auth \
  -e "REGISTRY_AUTH=htpasswd" \
  -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
  -e -e REGISTRY_STORAGE_DELETE_ENABLED=true \
  registry:2
docker run \
  --entrypoint htpasswd \
  registry:2 -Bbn usertest usertest@registery > auth/htpasswd

docker run -d  -p 5000:5000  --restart=always  --name registry  -v "$(pwd)"/auth:/auth  -e "REGISTRY_AUTH=htpasswd"  -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm"  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd   -e REGISTRY_STORAGE_DELETE_ENABLED=true  registry:2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment