Setup a Private Docker Registry

Self hosted PayloadCMS and PostgreSQL website on Docker

1 min read

Published Jun 17 2025, updated Jun 19 2025


10
0
0
0

CaddyDockerGitHub ActionsJavascriptNextJSPayloadCMSPortainerTailscaleUbuntuUFW

Now we are going to setup a private docker registry where we can store our image. You can always pay for a private account on Docker Hub if you don't want to do this step.


The registry is going to be secured with htpasswd authentication.

On your local computer, with docker installed, run this command:

docker run --rm --entrypoint htpasswd httpd:2 -Bbn myuser mypassword > auth

Replacing myuser and mypassword with whatever you would like to use to login to the registry.

This will create a file called auth.

Go to 'Configs' on the left menu of Portainer.

Click '+ Add Config'

Name it 'htpasswd' and paste the contents of the auth file you generated as the config value.


In Portainer, go to 'Stack' on the left hand menu and then click '+ Add Stack' button at the top right.

Give the stack a name, such as 'registry'.

In the web editor paste:

version: "3.8"

services:
  registry:
    image: registry:2
    restart: unless-stopped
    ports:
      - "5000:5000"
    networks:
      - shared_network
    environment:
      - REGISTRY_AUTH=htpasswd
      - REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm
      - REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd
    volumes:
      - registry_data:/var/lib/registry
    configs:
      - source: htpasswd
        target: /auth/htpasswd

volumes:
  registry_data:

networks:
  shared_network:
    external: true

configs:
  htpasswd:
    external: true

Click 'Deploy the Stack' button to deploy your registry with the authentication setup, running on port 5000.

In order to access it we need to add a reverse proxy with SSL enabled which we will do in the next section.




Products from our shop

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact