Hi,
I'm new to Traefik and I'm having a hard time getting a valid Let's Encrypt cert.
The site is served fine, however the cert is always invalid, DEFAULT TRAEFIK CERT. The acme.json is populated but the Certificate property is null.
I've included my docker-compose file below... hopefully someone can point me in the right direction?
Thanks for your help!
version: "3.3"
services:
traefik:
image: traefik:latest
restart: always
container_name: traefik
ports:
- "80:80"
- "8080:8080"
- "443:443"
command:
- --api.insecure=true
- --api.dashboard=true
- --api.debug=true
- --log.level=DEBUG
- --providers.docker=true
- --providers.docker.exposedbydefault=false
#- --providers.file.filename=/dynamic.yaml
- --providers.docker.network=web
- --entrypoints.web.address=:80
- --entrypoints.web-secured.address=:443
#- --certificatesresolvers.mytlschallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
#- --certificatesresolvers.mytlschallenge.acme.caserver=https://acme-v02.api.letsencrypt.org/directory
- --certificatesresolvers.mytlschallenge.acme.tlschallenge=true # <== Enable TLS-ALPN-01 to generate and renew ACME certs
- --certificatesresolvers.mytlschallenge.acme.email=dev@mydomain.com # <== Setting email for certs
- --certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json # <== Defining acme file to store cert information
volumes:
- ./letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock
- ./dynamic.yaml:/dynamic.yaml
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`monitor.mydomain.com`)"
- "traefik.http.routers.api.service=api@internal"
stagingapi:
image: myimage:dev
restart: always
container_name: stagingapi
ports:
- 5000:80
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:80"
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx-web.rule=Host(`stagingserver.mydomain.com`)"
- "traefik.http.routers.nginx-web.entrypoints=web"
- "traefik.http.routers.nginx-web.middlewares=redirect@file"
- "traefik.http.routers.nginx-secured.rule=Host(`stagingserver.mydomain.com`)"
- "traefik.http.routers.nginx-secured.entrypoints=web-secured"
- "traefik.http.routers.nginx-secured.tls.certresolver=mytlschallenge"
networks:
web:
external: true