Skip to content

Instantly share code, notes, and snippets.

@vst

vst/README.md

Last active Mar 11, 2020
Embed
What would you like to do?
Setting up a Local Docker Registry

Setting up a Local Docker Registry

Note: Follow the official guide.

bash setup.sh myusername mypassword
  • Authentication information is stored under /data/docker/registry/auth.
  • Storage directory is set to be /data/docker/registry/storage.
  • Registry is running at http://localhost:5000
version: "3"
services:
registry:
restart: always
image: registry:2
ports:
- 5000:5000
volumes:
- /data/docker/registry/storage:/var/lib/registry
- /data/docker/registry/auth:/auth
#!/usr/bin/env bash
## Stop on errors:
set -e
## Get the username and password:
_USER="${1}"
_PASS="${2}"
## Check username and password:
if [ -z "${_USER}" ]; then
echo "Username is not provided. Exiting..."
exit 1
elif [ -z "${_PASS}" ]; then
echo "Password is not provided. Exiting..."
exit 1
fi
## Create required directories:
mkdir -p /data/docker/registry/{auth,storage}
## Update the password:
docker run --entrypoint htpasswd registry:2 -Bbn "${_USER}" "${_PASS}" > /data/docker/registry/auth/htpasswd
## Run the registry:
docker-compose -f registry.yml up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment