Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Last active March 7, 2019 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/91f135797a223199b0bd57d6c2ca6c15 to your computer and use it in GitHub Desktop.
Save mraaroncruz/91f135797a223199b0bd57d6c2ca6c15 to your computer and use it in GitHub Desktop.
Setup docker registry
version: '3'
services:
registry:
image: registry:2
ports:
- "5000:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry
REGISTRY_AUTH_HTPASSWD_PATH: /auth/secret.password
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes:
- ./auth:/auth
- ./data:/data
#!/bin/bash
# Use ./dockerhub.bash install thisismyusername
set -e
ACTION=$1
USERNAME=$2
install () {
sudo apt update
sudo apt install -y apache2-utils
}
make_password() {
local user=$1
htpasswd -Bc secret.password $user
}
add_password() {
local user=$1
htpasswd -B secret.password $user
}
case $ACTION in
install)
echo "## Installing Dependencies ##"
install
;;
password)
echo "## Setting password ##"
make_password $USERNAME
;;
add)
echo "## Setting password ##"
add_password $USERNAME
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment