Illustrative WIUNIX Academy IT engineering workspace with server/network equipment and an instructional board: Private Docker registry with Nginx HTTPS and native authentication

WIUNIX ACADEMY

Private Docker registry with Nginx HTTPS and native authentication

Build an authenticated private OCI registry on Ubuntu, Debian, RHEL-family or Arch systems; verify HTTPS push/pull and plan consistent storage maintenance.

Intermediate70 min readUpdated
Make this guide yours

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

RHEL 9.8 (standard channel)Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment8 editable values

THE OUTCOME

What will you have at the end?

Push and pull private OCI images over trusted HTTPS while retaining data and authentication.

01Managed clientacademy-publisher → HTTPS registry.example.net:443
02Nginx → Distribution127.0.0.1:5000 → academy-registry (UID 23153)
03Persistent filesystem/srv/academy-registry/data · 1024 MiB · 900 s
Supported operating systems and versions

Documented DEB/RHEL/Arch paths; historical isolated protocol checks and outstanding operational acceptance are distinguished below.

Before you begin

  • Fresh dedicated VM and existing rootful Docker Engine ≥28; selected OS remains a documented path.
  • Trusted certificate/chain/key, DNS, TCP443 and an initialized client credential helper.
  • RPM hosts additionally require SELinux Enforcing and an existing Engine configured with SELinux support; stop and reconcile that prerequisite before this guide.

A private registry with a clear trust boundary

Build a single-node OCI image registry on a fresh dedicated Linux VM. Nginx terminates trusted HTTPS for registry.example.net; Distribution is published only at host loopback port 5000. Persistent data lives below /srv/academy-registry. This is an intermediate operations exercise, about 60 minutes plus certificate and backup preparation.

Native bcrypt authentication gives every enrolled user broad registry access. It is not repository-level RBAC, a vulnerability scanner, image signing or a highly available service. Choose a token authorization service before admitting mutually untrusted teams. A basic-auth password is protected by TLS; HTTPS must work before credentials are sent.

Set public examples before copying

Open the configuration form, edit the public values, press Apply, then copy. Pending or invalid edits disable copy. Defaults are examples, not evidence of installation. Never enter passwords, HTTP signing secrets, private keys or tokens in this form.

Values and custom progress stay in sessionStorage for this tab, language, article and OS environment. Default progress uses localStorage. Reset restores reviewed examples. Changing a value does not create DNS, reserve a port, change a firewall or execute a command.

Prepare the VM, clients and certificate

Use a fresh dedicated VM with sudo, sufficient disk/inodes for layers and backups, enabled signed distribution repositories, and an already installed rootful real Docker Engine ≥28. A docker command pointing to Podman is insufficient. Follow the OS owning installation method and avoid mixing Docker CE and conflicting distro packages. Plan any necessary engine upgrade separately before this exercise; older Engine loopback-publishing defects are a reason to stop.

Provide an IPv4 A record reaching this VM, intended-network TCP443, a current full certificate chain for registry.example.net, matching key and renewal procedure. This recipe listens on IPv4 only: do not publish an AAAA record until a separately reviewed IPv6 listener and firewall path are ready. Public issuance/ACME is outside this recipe; for a private CA, distribute managed CA trust to every client and Docker daemon before login.

Linux test clients need Docker, Python and an initialized pass credential helper with a usable GPG key. Other platforms may use their native helper, but that path was not executed here. Fix helper initialization rather than falling back to a base64 credential in JSON.

01

LET’S BUILD

Check engine, names, UID and ports

On the fresh VM, require a real rootful Docker Engine server component, not a Podman compatibility endpoint, and Engine major version at least28. Check the unused container name and reserve numeric UID/GID 23153 in your inventory. These checks do not create a host login. Port checks run after utility installation so this initial check does not require Python on a minimal host.

bash

Registry VM

set -eu
sudo docker version --format '{{range .Server.Components}}{{println .Name}}{{end}}' | grep -Fx Engine
engine_version=$(sudo docker version --format '{{.Server.Version}}')
engine_major=${engine_version%%.*}
case "$engine_major" in ''|*[!0-9]*) exit 1;; esac
test "$engine_major" -ge 28
security=$(sudo docker info --format '{{json .SecurityOptions}}')
printf '%s\n' "$security"
case "$security" in *rootless*) exit 1;; esac
if sudo docker container inspect 'academy-registry' >/dev/null 2>&1; then exit 1; fi
if getent passwd '23153' >/dev/null; then exit 1; fi
if getent group '23153' >/dev/null; then exit 1; fi
test "$(getenforce)" = Enforcing
printf '%s\n' "$security" | grep -F selinux
How do I know it worked?

Real rootful Engine ≥28, unused container name and free numeric UID/GID; no service changed.

02

LET’S BUILD

Install only the host-side utilities

Install only host utilities on this fresh dedicated VM; Distribution comes from the pinned image. Debian/Ubuntu use apache2-utils, RPM uses httpd-tools, and Arch uses apache for htpasswd without starting Apache. Nginx may start automatically on Debian/Ubuntu; check ports again after installation.

RPM paths use the enabled supported BaseOS/AppStream channels, without switching streams or adding EPEL/CRB. The standard-channel reviewed minors are9.8 and10.2; an older RHEL EUS minor requires its own active entitlement and package review. Arch/Manjaro installation explicitly performs a full system upgrade: review the transaction and reboot requirements first, on this fresh VM. Never mix Arch repositories into Manjaro.

bash

Registry VM

set -eu
. /etc/os-release
test "$ID" = 'rhel'
test "$VERSION_ID" = '9.8'
sudo dnf repolist --enabled
sudo dnf info nginx httpd-tools python3 container-selinux
sudo dnf install nginx httpd-tools python3 openssl ca-certificates curl nano iproute policycoreutils-python-utils container-selinux audit
rpm -q nginx httpd-tools python3 container-selinux
sudo python3 - <<'PY'
import socket
for port in (443, 5000):
    with socket.socket() as s:
        s.bind(('0.0.0.0',port))
print('Required IPv4 ports are currently free')
PY
How do I know it worked?

Selected OS matches; installed packages are listed and required ports are currently available.

03

LET’S BUILD

Reserve storage and open a protected password editor

Run on the VM. The absolute path /srv/academy-registry must be a new child below an existing real /srv directory. Every existing path component is checked for symlinks; existing data is never adopted or recursively chowned. The numeric registry process owns only its data directory. Root retains auth/config ownership; the container GID can read them.

In the root-only editor enter one randomly generated password, a single line of 20–72 printable ASCII bytes without spaces. Obtain it from your approved password manager; do not put it in a shell argument, browser form, screenshot or command history. Save and close. The plaintext file is temporary and root-only.

bash

Registry VM

sudo python3 - <<'PY'
import os
from pathlib import Path
p=Path('/srv/academy-registry')
assert p.is_absolute() and len(p.parts)>=3 and p.parts[1]=='srv'
for part in [p,*p.parents]:
    assert not part.is_symlink(), 'Symlink path rejected'
assert p.parent.is_dir() and not p.exists(), 'Fresh dedicated path required'
os.mkdir(p,0o750)
os.chown(p,0,23153)
for name in ('data','auth','config','tls','recovery'):
    d=p/name; os.mkdir(d,0o700)
    if name=='data': os.chown(d,23153,23153)
    elif name in ('auth','config'):
        os.chown(d,0,23153); os.chmod(d,0o750)
f=p/'auth/password-input'
fd=os.open(f,os.O_WRONLY|os.O_CREAT|os.O_EXCL|os.O_NOFOLLOW,0o600)
os.close(fd)
print('Dedicated directories reserved; protected password editor file is empty')
PY
sudo nano '/srv/academy-registry/auth/password-input'
How do I know it worked?

New protected directories exist; password-input is root-owned 0600.

Explore all tutorials ↗