Using Cloudflare as DNS provider and Let's Encrypt for certificates. Seems like the Traefik container doesn't see the CF_DNS_API_TOKEN
environment variable, even though docker inspect
does show it. Would appreciate it if anyone could help me out, I've been stumped for the past hour or so trying to get this all working >.>
error message
level=error msg="Unable to obtain ACME certificate for domains \"test-traefik\": cannot get ACME client cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN" routerName=websecure-entrypoints@docker rule="Host(`test-traefik`)" providerName=le.acme ACME CA="https://acme-staging-v02.api.letsencrypt.org/directory"
level=error msg="Unable to obtain ACME certificate for domains \"test-traefik\": cannot get ACME client cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN" ACME CA="https://acme-staging-v02.api.letsencrypt.org/directory" providerName=le.acme routerName=websecure-entrypoints@docker rule="Host(`test-traefik`)"
I'm also getting these errors on startup, but I'm not sure they're related:
level=error msg="accept tcp [::]:8080: use of closed network connection" entryPointName=traefik
level=error msg="Error while starting server: accept tcp [::]:8080: use of closed network connection" entryPointName=traefik
level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
level=error msg="Error while starting server: accept tcp [::]:80: use of closed network connection" entryPointName=web
level=error msg="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
level=error msg="close tcp [::]:443: use of closed network connection" entryPointName=websecure
level=info msg="Configuration loaded from file: /etc/traefik/traefik.yml"
level=error msg="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
level=error msg="Error while starting server: accept tcp [::]:443: use of closed network connection" entryPointName=websecure
level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
level=error msg="close tcp [::]:80: use of closed network connection" entryPointName=web
level=error msg="accept tcp [::]:8080: use of closed network connection" entryPointName=traefik
level=error msg="close tcp [::]:8080: use of closed network connection" entryPointName=traefik
Here are the files I'm using:
docker-compose.yml
version: '3'
services:
traefik:
container_name: traefik
image: traefik:latest
ports:
- "80:80"
- "443:443"
- "8888:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/etc/traefik/traefik.yml:ro
- ./acme.json:/acme.json
environment:
- CF_DNS_API_TOKEN=redacted # had secret, returned to basic env var for debugging
restart: always
traefik.yml
(static configuration)
api:
insecure: true
dashboard: true
providers:
docker:
exposedByDefault: false
entryPoints:
web:
address: ':80'
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ':443'
http:
tls:
certResolver: le
domains:
- main: "*.redacted.com"
sans: "redacted.com"
certificatesResolvers:
le:
acme:
email: "redacted"
storage: "acme.json"
dnsChallenge:
provider: cloudflare
caServer: https://acme-staging-v02.api.letsencrypt.org/directory