76 lines
2.1 KiB
Plaintext
76 lines
2.1 KiB
Plaintext
Docker Registry Template
|
|
========================
|
|
|
|
A private Docker registry with htpasswd authentication.
|
|
|
|
SETUP INSTRUCTIONS
|
|
------------------
|
|
|
|
1. Create the htpasswd file for authentication:
|
|
|
|
# Create a new htpasswd file with the first user:
|
|
docker run --rm --entrypoint htpasswd httpd:2 -Bbn USERNAME PASSWORD > ${LOCAL_CONFIG_PATH}/htpasswd
|
|
|
|
# Add additional users:
|
|
docker run --rm --entrypoint htpasswd httpd:2 -Bbn ANOTHER_USER PASSWORD >> ${LOCAL_CONFIG_PATH}/htpasswd
|
|
|
|
Replace USERNAME and PASSWORD with your desired credentials.
|
|
The -B flag uses bcrypt encryption (recommended for security).
|
|
|
|
2. Install the service:
|
|
dropshell install $SERVER $SERVICE
|
|
|
|
CONFIGURATION
|
|
-------------
|
|
|
|
Edit the service.env file to customize:
|
|
- CONTAINER_NAME: Name of the container (default: docker-registry)
|
|
- REGISTRY_PORT: Port to expose the registry (default: 5000)
|
|
- IMAGE_TAG: Registry version (default: 2)
|
|
|
|
USAGE
|
|
-----
|
|
|
|
After installation, configure Docker clients to use your registry:
|
|
|
|
1. For HTTPS (recommended for production):
|
|
Your registry should be behind a reverse proxy (e.g., Caddy) with TLS.
|
|
|
|
docker login registry.yourdomain.com
|
|
docker push registry.yourdomain.com/myimage:tag
|
|
docker pull registry.yourdomain.com/myimage:tag
|
|
|
|
2. For HTTP (testing only - insecure):
|
|
Add to /etc/docker/daemon.json on each client:
|
|
{
|
|
"insecure-registries": ["your-server-ip:5000"]
|
|
}
|
|
Then restart Docker and:
|
|
|
|
docker login your-server-ip:5000
|
|
docker push your-server-ip:5000/myimage:tag
|
|
|
|
MANAGING USERS
|
|
--------------
|
|
|
|
To add a new user:
|
|
docker run --rm --entrypoint htpasswd httpd:2 -Bbn NEWUSER PASSWORD >> ${LOCAL_CONFIG_PATH}/htpasswd
|
|
dropshell install $SERVER $SERVICE # Restart to apply changes
|
|
|
|
To remove a user:
|
|
Edit ${LOCAL_CONFIG_PATH}/htpasswd and remove the line for that user.
|
|
dropshell install $SERVER $SERVICE # Restart to apply changes
|
|
|
|
DATA STORAGE
|
|
------------
|
|
|
|
All registry data (images, blobs, etc.) is stored in a Docker volume:
|
|
${CONTAINER_NAME}_data
|
|
|
|
This maps to /var/lib/registry inside the container.
|
|
|
|
PORTS
|
|
-----
|
|
|
|
- 5000 (configurable via REGISTRY_PORT): Docker registry API
|