Sign inSign up

domaineering/registry-setup

By domaineering

•Updated almost 2 years ago

Image
0

213

domaineering/registry-setup repository overview

⁠Docker Registry with Hot/Cold Storage

A complete setup for running a private Docker registry with automated hot/cold storage management using Hetzner Storage Box.

⁠Features

  • Private Docker registry with hot and cold storage tiers
  • Automatic migration of older images to cold storage
  • Automatic retrieval of images when needed
  • Monitoring and management scripts included
  • Support for both password and SSH key authentication

⁠Prerequisites

  • Ubuntu 22.04 or later
  • Hetzner Storage Box
  • At least 40GB available for hot storage
  • Docker installed on host system

⁠Quick Start

docker run -it --privileged \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /mnt:/mnt \
  -v /opt:/opt \
  domaineering/registry-setup:latest \
  /setup/fullsetup.sh

You'll be prompted for:

  • Storage Box username (e.g., u123456)
  • Storage Box hostname (e.g., u123456.your-storagebox.de)
  • Authentication method (password or SSH key)

⁠Storage Architecture

  • Hot Storage: /opt/docker-registry/data/hot

    • Recent and frequently accessed images
    • Fast access, limited space
    • Default retention: 24 hours
  • Cold Storage: /mnt/storagebox/docker-registry

    • Older and less frequently accessed images
    • Unlimited space, slightly slower access
    • Automatic migration from hot storage

⁠Using the Registry

⁠On Client Machines
  1. Configure Docker daemon:
cat > /etc/docker/daemon.json << EOF
{
  "insecure-registries": ["YOUR_SERVER_IP:5000"]
}
EOF
  1. Restart Docker:
systemctl restart docker
⁠Push Images
docker tag your-image:tag YOUR_SERVER_IP:5000/your-image:tag
docker push YOUR_SERVER_IP:5000/your-image:tag
⁠Pull Images
docker pull YOUR_SERVER_IP:5000/your-image:tag

⁠Monitoring

The setup includes several monitoring tools:

# Check registry status and storage usage
/opt/docker-registry/scripts/monitor.sh

# View migration logs
tail -f /var/log/registry-migration.log

# View cache manager logs
docker compose logs -f cache-manager

⁠Management Scripts

  • /opt/docker-registry/scripts/monitor.sh: Status and storage monitoring
  • /opt/docker-registry/scripts/migrate-storage.sh: Manual migration to cold storage
  • /opt/docker-registry/scripts/cache-manager.sh: Handles retrieval from cold storage

⁠Security Notes

  • This setup uses HTTP (not HTTPS)
  • Suitable for internal networks
  • For production internet use:
    • Configure TLS certificates
    • Implement authentication
    • Review security settings

⁠Troubleshooting

⁠Common Issues
  1. Push failures:

    • Check client Docker daemon configuration
    • Verify network connectivity
    • Check available disk space
  2. Slow pulls:

    • First pull from cold storage may be slower
    • Check network connectivity
    • Monitor cache manager logs
  3. Storage issues:

    • Check hot storage: du -sh /opt/docker-registry/data/hot
    • Check cold storage: du -sh /mnt/storagebox/docker-registry
    • Review logs: tail -f /var/log/registry-migration.log

⁠Support

For issues and feature requests, please visit: [GitHub Repository URL]

⁠License

MIT License - feel free to use and modify as needed.

The image has been successfully built and pushed to your Docker Hub! You can verify it at docker.io/domaineering/registry-setup. However, to actually use this setup on a new server, you would: Pull and run the setup container: docker run -it --privileged
-v /var/run/docker.sock:/var/run/docker.sock
-v /mnt:/mnt
-v /opt:/opt
domaineering/registry-setup:latest
/setup/fullsetup.sh

The container will prompt for: Storage Box username Storage Box hostname Authentication method choice A few notes: The --privileged flag is needed for mounting the storage box We mount several host directories to persist the setup The setup will configure the host system through these mounts Would you like me to: Test the container on a fresh system to verify it works? Add better documentation to the Docker Hub description? Create a simpler version that doesn't require privileged mode? Let me know what you'd like to focus on next!

Now you can: Login to push/pull: docker login 188.245.235.6:5000 View and manage images at: http://188.245.235.6:8080⁠ Add descriptions and metadata through the web interface Would you like me to:

  1. Add more security features (HTTPS, IP whitelisting)? Enhance the UI with more features? Create a script to backup the metadata?

Tag summary

Content type

Image

Digest

sha256:b700d913b…

Size

53.9 MB

Last updated

almost 2 years ago

docker pull domaineering/registry-setup