Updated: 28 September 2026 · Applies to: Ubuntu 24.04 LTS

Ubuntu 18.04 is no longer supported; this guide uses Ubuntu 24.04 LTS.

A private registry stores your own Docker images.

Install Docker Engine (official repository)

Ubuntu 24.04 / Debian 12:

apt install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

On Debian, use https://download.docker.com/linux/debian in both the key URL and URIs.

AlmaLinux 9 / Rocky Linux 9:

dnf install dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker

Test with docker run hello-world. Compose is available as docker compose.

Run the registry with a password

apt install apache2-utils
mkdir -p /opt/registry/auth
htpasswd -Bbn youruser 'Strong-Password' > /opt/registry/auth/htpasswd
docker run -d --restart=always --name registry -p 127.0.0.1:5000:5000 \
  -v /opt/registry/data:/var/lib/registry -v /opt/registry/auth:/auth \
  -e REGISTRY_AUTH=htpasswd -e REGISTRY_AUTH_HTPASSWD_REALM=Registry \
  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:3

Add HTTPS with Nginx

Proxy registry.example.com to 127.0.0.1:5000 (see the reverse proxy guide), add client_max_body_size 0; for large image layers, and get a certificate with Certbot.

Use it

docker login registry.example.com
docker tag myapp registry.example.com/myapp:1.0
docker push registry.example.com/myapp:1.0

Check the registry

curl -u youruser https://registry.example.com/v2/_catalog          # list repositories
curl -u youruser https://registry.example.com/v2/myapp/tags/list     # list tags

Common problems

  • http: server gave HTTP response to HTTPS client: Docker only talks to registries over HTTPS. Use the Nginx proxy with a valid certificate instead of adding an insecure registry.
  • 413 Request Entity Too Large: add client_max_body_size 0; to the Nginx server block.
  • unauthorized: run docker login registry.example.com again, and check the htpasswd file uses bcrypt (-B).

Tip: Back up /opt/registry/data; it holds all image layers.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket