How to configure docker lable to generate Wildcard Certificate

Hello,
I try to started my service by below command:

docker service create \
    --name whoami-1 \
    --mode global \
    --network web \
    --label 'traefik.enable=true' \
    --label 'traefik.docker.network=web' \
    --label 'traefik.http.services.whoami-1.loadbalancer.server.port=80' \
    --label 'traefik.http.routers.whoami-1.rule=Host(`whoami-1.mydomain.com`)' \
    --label 'traefik.http.routers.whoami-1.entrypoints=web' \
    --label 'traefik.http.routers.whoami-1-https.rule=Host(`whoami-1.mydomain.com`)' \
    --label 'traefik.http.routers.whoami-1-https.entrypoints=websecure' \
    --label 'traefik.http.routers.whoami-1-https.tls.certresolver=mydnschallenge' \
    --label 'traefik.http.routers.whoami-1-https.tls.domains.main=*.mydomain.com' \
    --label 'traefik.http.routers.whoami-1-https.tls.domains.sans=mydomain.com' \
    containous/whoami:latest

And I got the error log like is:

time="2019-09-24T09:33:47Z" level=error msg="Unable to obtain ACME certificate for domains \"\" : unable to generate a certificate in ACME provider when no domain is given" providerName=mydnschallenge.acme

As the log shows: It looks like Traefik didn't get my domain names. But i gave the doamin names.
And i read the document but didn't find anything help

docker service create \
    --name whoami-1 \
    --mode global \
    --network web \
    --label 'traefik.enable=true' \
    --label 'traefik.docker.network=web' \
    --label 'traefik.http.services.whoami-1.loadbalancer.server.port=80' \
    --label 'traefik.http.routers.whoami-1.rule=Host(`whoami-1.mydomain.com`)' \
    --label 'traefik.http.routers.whoami-1.entrypoints=web' \
    --label 'traefik.http.routers.whoami-1-https.rule=Host(`whoami-1.mydomain.com`)' \
    --label 'traefik.http.routers.whoami-1-https.entrypoints=websecure' \
    --label 'traefik.http.routers.whoami-1-https.tls.certresolver=mydnschallenge' \
    --label 'traefik.http.routers.whoami-1-https.tls.domains[0].main=*.mydomain.com' \
    --label 'traefik.http.routers.whoami-1-https.tls.domains[0].sans=mydomain.com' \
    containous/whoami:latest

https://docs.traefik.io/v2.0/routing/providers/docker/#routers

1 Like