🚀 Docker Registry + Web UI deployment solution (lightweight)
This plan usesDocker RegistryBuild a private mirror warehouse and use itdocker-registry-uiProvides a web interface forIndividual or small team。
🚀 1. Deploy Docker Registry
First, runDocker Registry,monitor5000
port:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
- This will5000 portstart upPrivate Docker image repository。
- The image is stored by default
/var/lib/registry
Table of contents.
📌 Whether the test was successful
curl http://localhost:5000/v2/_catalog
If return{ "repositories": [] }
,expressRegistry runs normally。
🚀 2. Deploy the Web UI
useJoxit/docker-registry-ui
supplyWeb Management Interface:
docker run -d -p 8080:80 --restart=always --name registry-ui \
-e REGISTRY_TITLE="My Private Registry" \
-e NGINX_PROXY_PASS="http://registry:5000" \
--link registry \
joxit/docker-registry-ui:latest
📌 2.1 Accessing the Web UI
Now, open your browser and access:
http://localhost:8080
You will seeDocker Registry's Web UI 🎉。
🚀 3. Push and pull mirrors
📌 3.1 Tag local mirror
docker tag ubuntu:latest localhost:5000/ubuntu:latest
📌 3.2 Push mirror
docker push localhost:5000/ubuntu:latest
📌 3.3 Pull the mirror
docker pull localhost:5000/ubuntu:latest
📌 3.4 View mirrors in the warehouse
curl http://localhost:5000/v2/_catalog
🚀 4. Configure Docker to allow HTTP access
By default, DockerHTTP access to private Registry is not allowedYou need to/etc/docker/
Add to:
{
"insecure-registries": ["localhost:5000"]
}
Then restart Docker:
systemctl restart docker
🚀 5. Configure Registry data storage
If you wantChange storage path, can map aLocal Directory:
docker run -d -p 5000:5000 --restart=always \
-v /data/registry:/var/lib/registry \
--name registry registry:2
All images will be stored in/data/registry
Table of contents.
🚀 6. Secure access using HTTPS (recommended production environment)
📌 6.1 Generate a self-signed SSL certificate
mkdir -p /certs && cd /certs
openssl req -newkey rsa:4096 -nodes -sha256 -keyout -x509 -days 365 -out
When filling in the certificate information,Common Name (CN)
Need to fill in yourDomain name or IP address。
📌 6.2 Running Registry with HTTPS
docker run -d -p 443:5000 --restart=always \
-v /certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/ \
-e REGISTRY_HTTP_TLS_KEY=/certs/ \
--name registry registry:2
Now availableAccess private repository.
📌 6.3 Configuring Trusted Certificates in Docker
WillCopy to:
cp /certs/ /etc/docker///
Then restart Docker:
systemctl restart docker
🚀 7. Configure username and password authentication (more secure)
If you needUsername + Password Authentication:
mkdir -p /auth
docker run --entrypoint htpasswd registry:2 -Bbn myuser mypassword > /auth/htpasswd
📌 7.1 Running Registry with Certification
docker run -d -p 5000:5000 --restart=always \
-v /auth:/auth \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" \
--name registry registry:2
📌 7.2 Log in to the private repository
docker login localhost:5000
entermyuser / mypassword
Just do it.