Skip to content

Instantly share code, notes, and snippets.

@max-lt
Created September 9, 2018 15:20
Show Gist options
  • Save max-lt/028b898cfcae30f30755a55786c91507 to your computer and use it in GitHub Desktop.
Save max-lt/028b898cfcae30f30755a55786c91507 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if [ -z "$1" ]
then
echo "Missing destination file parameter."
echo "Usage: $0 path/to/dest"
echo "Example: $0 /srv/registry/security/htpasswd"
exit 1;
fi
DEST=$1
echo "Enter the new username:"
read -r USERNAME
echo "Enter the associated password:"
read -rs PASSWORD
docker run registry:2 htpasswd -Bbn ${USERNAME} ${PASSWORD} >> $DEST
#!/usr/bin/env bash
docker run -d \
-p 3443:5000 \
--name registry \
-v /srv/registry/data:/var/lib/registry \
-v /srv/registry/security/htpasswd:/etc/security/htpasswd \
-v /srv/certificates:/etc/certificates \
-e REGISTRY_HTTP_HOST=https://registry.pleem.fr \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/etc/certificates/example.com.crt \
-e REGISTRY_HTTP_TLS_KEY=/etc/certificates/example.com.key \
-e REGISTRY_AUTH=htpasswd \
-e REGISTRY_AUTH_HTPASSWD_PATH=/etc/security/htpasswd \
-e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" \
registry:2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment