services: registry: image: registry:2 container_name: docker-registry restart: unless-stopped environment: - REGISTRY_AUTH=htpasswd - REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm - REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd - REGISTRY_STORAGE_DELETE_ENABLED=true ports: # Only reachable from the VPS itself. Docker treats 127.0.0.0/8 as # trusted, so pushes/pulls work here without TLS. Reach it from # elsewhere via an SSH tunnel (see scripts/deploy.sh). - "127.0.0.1:5000:5000" volumes: - registry-data:/var/lib/registry - ./auth:/auth:ro watchtower: image: containrrr/watchtower container_name: watchtower restart: unless-stopped environment: - WATCHTOWER_LABEL_ENABLE=true - WATCHTOWER_HTTP_API_UPDATE=true - WATCHTOWER_HTTP_API_TOKEN=${WATCHTOWER_TOKEN} - WATCHTOWER_CLEANUP=true ports: - "127.0.0.1:8080:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock # Reuses the VPS's own `docker login localhost:5000` credentials # so Watchtower can pull the private image. - ~/.docker/config.json:/config.json:ro volumes: registry-data: