This Docker setup creates a containerized SWNG repository mirror for CloudLinux 10 that automatically syncs from upstream.cloudlinux.com using RSync.
- Docker or Docker Compose
- Sufficient disk space (100-200 GB per version recommended)
- Network access to
rsync.upstream.cloudlinux.com
Approximate requirements:
- CPU: 2-4 cores recommended
- Memory: 2-4 GB RAM recommended
- Disk: 500 GB - 1+ TB recommended
- Network: Stable, high-bandwidth connection
CLOUDLINUX_VERSION: CloudLinux version to mirror (required:10)RSYNC_SOURCE: RSync source URL (auto-generated based on version)MIRROR_PATH: Mirror destination path (auto-generated based on version)LOG_FILE: Log file path (auto-generated based on version)INITIAL_SYNC: Run initial sync on startup (default:true)SYNC_INTERVAL_HOURS: Sync interval in hours (default:6)CERTBOT_EMAIL: Email for Let's Encrypt registration (default:admin@example.com)CERTBOT_DOMAIN: Public domain for the mirror (default:mirror.example.com)
./mirror-data/10- Mirror repository data for CloudLinux 10 (persistent)./mirror-data/8- Mirror repository data for CloudLinux 8 (persistent)./logs- Log files (persistent)certbot-etc- Let's Encrypt certificates (persistent volume)certbot-www- ACME webroot (persistent volume)
Check that docker/compose installed
docker --version
docker compose versionIf docker/compose not installed
dnf -y install dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
systemctl enable --now docker- Create directories for data and logs:
mkdir -p mirror-data/10 logs
#for both versions
mkdir -p /storage/mirror-data/10 /storage/logsIf you want to store data on a separate disk (e.g. /storage), create them there and set env vars.
Recommended: put them in a .env near with docker-compose.yml:
cat > .env <<'EOF'
MIRROR_DATA_ROOT=/storage/mirror-data
LOGS_ROOT=/storage/logs
CERTBOT_EMAIL=admin@example.com
CERTBOT_DOMAIN=mirror.example.com
EOFMake sure CERTBOT_DOMAIN points to this server (DNS A/AAAA record) and ports 80/443 are open.
- Start the container:
DOCKER_BUILDKIT=1 docker build --network=host -t swng-version-mirror .
docker compose up -d --no-build- View logs:
docker compose logs -f swng-10-mirrorOn first run, Nginx starts in HTTP-only mode for ACME. Once the certificate is issued, it will automatically reload and enable HTTPS.
- Build the image:
docker build -t swng-version-mirror .- Run the container for CloudLinux 10:
docker run -d \
--name swng-10-mirror \
--restart unless-stopped \
-v $(pwd)/mirror-data/10:/var/www/mirrors/swng/10 \
-v $(pwd)/logs:/var/log \
-e CLOUDLINUX_VERSION=10 \
-e INITIAL_SYNC=true \
swng-version-mirror# View container logs
docker compose logs -f swng-10-mirror
# View sync log
tail -f logs/swng-10-mirror.log
# Check mirror data
ls -lh mirror-data/10/# Execute sync script manually
docker compose exec swng-10-mirror /usr/local/bin/sync-script.shThe Docker Compose setup includes an Nginx service that automatically serves the mirrors. The mirrors are accessible via:
- CloudLinux 10:
http://localhost/swng/10/ - CloudLinux 8:
http://localhost/swng/8/(Temporary unavalible) - Network access:
http://<server-ip>/swng/<version>/ - HTTPS:
https://<your-domain>/swng/<version>/
The Nginx configuration enables directory browsing, so you can navigate the repository structure through a web browser.
The docker-compose.yml includes a pre-configured Nginx service that:
- Serves the mirror data from the
mirror-datadirectory - Enables directory browsing for each version
- Runs on ports 80/443
- Automatically starts with the mirror containers
- Each version requires its own container
- Initial sync may take several hours per version
- The container runs cron internally for scheduled syncs
- Mirror data persists in the
mirror-datadirectory - Logs are stored in the
logsdirectory - Nginx automatically serves the mirrors via HTTP/HTTPS