version: '3.1'
services:
    registry:
        image: registry:2.6.2
        volumes:
            - /opt/docker-registry:/var/lib/registry
        environment:
            - REGISTRY_HTTP_SECRET=my_registry_secret
            - REGISTRY_STORAGE_DELETE_ENABLED=true
        deploy:
          placement:
            constraints: [node.role == manager]

    ui:
        image: joxit/docker-registry-ui:static
        environment:
            - DELETE_IMAGES=true
            - REGISTRY_TITLE=My Private Docker Registry
            - REGISTRY_URL=http://docker-registry_registry:5000
        depends_on: ['registry']
        networks: ['proxy', 'default']
        deploy:
          labels:
            traefik.backend: 'registry.mydomain.com'
            traefik.frontend.rule: 'Host:registry.mydomain.com'
            traefik.enable: 'true'
            traefik.port: 80
            traefik.docker.network: 'traefik-net'
            traefik.frontend.auth.basic: 'admin:$apr1$XXrpwZre$ItZSXpoeB6bdPLCGT7eXG0'
            traefik.frontend.passHostHeader: 'true'

networks:
    proxy: {external: {name: 'traefik-net'}}