Self-hosted docker registry on Debian


  • Docker
  • Caddy web server as reverse proxy

Docker daemon

You will get a personal registry with basic auth and store registry on your local machine.

# Make directory

mkdir ~/docker_registry

# Go inside docker_registry directory
cd ~/docker_registry

# Setup basic auth

mkdir auth/

docker run \
   --entrypoint htpasswd \
   httpd:2 -Bbn username password > auth/htpasswd

# Run registry daemon

docker run -d \
  -v "$(pwd)"/auth:/auth \
  -e "REGISTRY_AUTH=htpasswd" \
  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
  -p 5000:5000 --restart always \
  --name registry -v /root/docker_registry:/var/lib/registry \

Caddy configuration

# Caddy config

nano /etc/caddy/Caddyfile

# Paste into your config
 auto_https disable_redirects

# Docker registry {
  reverse_proxy http://localhost:5000

Client do docker login

docker login

Docker push image to your private registry

# Docker tag local image
docker tag busybox

# OR
# Docker commit your custom build image
docker commit 6c664ed7afbb

# Finally push to your private registry
docker push

Photos credit: