Disable traefik on some containers

Hello, I have several containers configured in a docker compose file, and all my configuration is in a compose file.

I have some container that do not need a router or a ssl certificate, but it seems that traefik creates a router automatically even if I specify "traefik.enable=false" for the mssql container.

    labels:
      - "traefik.enable=false"

I still get this error:

2024-05-07T15:09:06Z ERR Unable to obtain ACME certificate for domains error="unable to generate a certificate for the domains [mssql-staging]: acme: error: 400 :: POST :: https://acme-v02.api.letsencrypt.org/acme/new-order :: urn:ietf:params:acme:error:rejectedIdentifier :: Error creating new order :: Cannot issue for \"mssql-staging\": Domain name needs at least one dot" ACME CA=https://acme-v02.api.letsencrypt.org/directory acmeCA=https://acme-v02.api.letsencrypt.org/directory domains=["mssql-staging"] providerName=company-certresolver.acme routerName=mssql-staging@docker rule=Host(`mssql-staging`)

My traefik configuration looks like this:

  reverse-proxy:
    image: traefik:v3.0
    container_name: reverse-proxy
    restart: unless-stopped
    command:
      - "--log.level=${TRAEFIK_LOG_LEVEL}"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entrypoint.to=web-secure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.web-secure.address=:443"
      - "--entrypoints.web-secure.asdefault=true"
      - "--entrypoints.web-secure.http.tls=true"
      - "--entrypoints.web-secure.http.tls.certresolver=company-certresolver"
      - "--certificatesresolvers.company-certresolver.acme.tlschallenge=true"
      - "--certificatesresolvers.company-certresolver.acme.email=support@company.com"
      - "--certificatesresolvers.company-certresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "443:443"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - reverse-proxy-data:/letsencrypt

I would like to know why traefik is trying to create a router for mssql and then aking for a certificate that I do not need.

Thanks for your help! Have a great day!

Check doc:

exposedByDefault

Optional, Default=true

Expose containers by default through Traefik. If set to false, containers that do not have a traefik.enable=true label are ignored from the resulting routing configuration.

For additional information, refer to Restrict the Scope of Service Discovery.

Thanks @bluepuma77

I already checked the doc and I'm aware of exposedByDefault but I tried to set it on my traefik container by adding this to the command section:

- "--providers.docker.exposedbydefault=false"

But it won't work. I would like to keep all the configuration in the compose file if possible. Any idea?

Hey @Rafarel did you ever figure this out?

I’m having the same issue.

Did you try to completely remove this from labels?

Maybe compare to simple Traefik example.