Skip to content

Instantly share code, notes, and snippets.

@lsl
Last active January 28, 2018 18:16
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 lsl/a4637edf5553f27e475ae9191d832255 to your computer and use it in GitHub Desktop.
Save lsl/a4637edf5553f27e475ae9191d832255 to your computer and use it in GitHub Desktop.
Simple private docker registry setup for running on remote hosts (docker-compose, ssl, letsencrypt, basic auth)
# Simple registry setup
#
# Replace mydomain.com with your domain and ensure
# registry.mydomain.com points at your server.
#
# https://docs.docker.com/registry/configuration/
#
# Create your basic auth password file:
#
# % htpasswd -c -B htpasswd USERNAME
#
# Run docker-compose to bring it up
#
# % docker-compose up -d
#
# Test it
#
# % docker login registry.mydomain.com
#
version: '3.1'
volumes:
registry-data:
external: true
registry-lets:
external: true
services:
registry:
image: registry:2
restart: always
ports:
- "443:5000"
#- "5001:5001"
volumes:
- ./htpasswd:/htpasswd
- registry-data:/var/lib/registry
- registry-lets:/lets
environment:
REGISTRY_STORAGE_DELETE_ENABLED: "true"
REGISTRY_HTTP_TLS_LETSENCRYPT_CACHEFILE: /lets/cache.json
REGISTRY_HTTP_TLS_LETSENCRYPT_EMAIL: 'me@mydomain.com'
REGISTRY_HTTP_ADDR: ':5000'
REGISTRY_HTTP_HOST: 'https://registry.mydomain.com'
REGISTRY_AUTH_HTPASSWD_REALM: 'registry.mydomain.com'
REGISTRY_AUTH_HTPASSWD_PATH: /htpasswd
#REGISTRY_HTTP_DEBUG_ADDR: ':5001'
#REGISTRY_LOG_LEVEL: debug
@horacioh
Copy link

so, just docker-compose up and thats it??

@shukriadams
Copy link

shukriadams commented Jan 28, 2018

Tested on Ubuntu 16.04, doesn't work, not on a clean system at any rate. The container as it stands here can't see out properly while accepting secured connections. Getting a working private reg takes a bit more than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment