Traefik docker container labels for custom port & ALPN certificate
See our previous post Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges for the general config we’re using to deploy Traefik. This includes the configuration of the alpn
certificate resolver.
If you want to automatically connect Traefik to your docker container on a specific port running on the docker container (17029
in this example), use labels like
labels:
- "traefik.enable=true"
- "traefik.http.routers.my-webservice.rule=Host(`subdomain.mydomain.com`)"
- "traefik.http.routers.my-webservice.entrypoints=websecure"
- "traefik.http.routers.my-webservice.tls.certresolver=alpn"
- "traefik.http.services.my-webservice.loadbalancer.server.port=17029"