Skip to content

Instantly share code, notes, and snippets.

@shearluck
Last active May 15, 2019 10:53
Show Gist options
  • Save shearluck/630ab1c1f147ee9182ff9c127cebe5f0 to your computer and use it in GitHub Desktop.
Save shearluck/630ab1c1f147ee9182ff9c127cebe5f0 to your computer and use it in GitHub Desktop.
mkdir .auth
# Create basic auth
docker run \
--entrypoint htpasswd \
registry:2 -Bbn testuser testpassword > .auth/htpasswd
# Make sure to serve this into an HTTPS load balancer/frontend
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 \
registry:2
# Registry frontend
sudo docker run \
--name registry-ui \
--restart=always \
-d \
-e ENV_DOCKER_REGISTRY_HOST=ENTER-YOUR-REGISTRY-HOST-HERE \
-e ENV_DOCKER_REGISTRY_PORT=ENTER-PORT-TO-YOUR-REGISTRY-HOST-HERE \
-e ENV_DOCKER_REGISTRY_USE_SSL=1 \
-e ENV_MODE_BROWSE_ONLY=true \
-p 8080:80 \
konradkleine/docker-registry-frontend:v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment