Setup a Private Docker Registry

Self hosted PayloadCMS and PostgreSQL website on Docker

1 min read

Published Jun 17 2025, updated Aug 17 2026


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/htpasswdvolumes:  registry_data:networks:  shared_network:    external: trueconfigs:  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.



© 2025 SimpleSteps.guide
AboutFAQPoliciesContact
Self hosted PayloadCMS and PostgreSQL website on Docker | Setup a Private Docker Registry | SimpleSteps.guide