Traefik error dial tcp: lookup authelia on 127.0.0.11:53: no such host

Trying to configure Authelia and I'm getting the following error when accessing service protected by Authelia

level=debug msg="Error calling http://authelia:9091/api/verify?rd=https://login.domain.com/. Cause: Get \"http://authelia:9091/api/verify?rd=https://login.domain.com/\": dial tcp: lookup authelia on 127.0.0.11:53: no such host" middlewareName=authelia@docker middlewareType=ForwardedAuthType

Here are the respective configs:

version: "3.8"
services:
  traefik:
    image: "traefik:latest"
    command:
      - --log.level=DEBUG
      - --api.insecure=true
      - --api.dashboard=true
      - --api.debug=true
      - --providers.docker=true
      - --providers.docker.swarmMode=true
      - --providers.docker.exposedbydefault=false
#      - --providers.file.filename=/configurations/dynamic.ymal
      - --providers.file.directory=/configurations/
      - --providers.file.watch=true
      - --providers.docker.network=traefik
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --entrypoints.irc.address=:6502
      - --certificatesresolvers.letsencrypt.acme.dnschallenge=true
      - --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare
      - --certificatesresolvers.letsencrypt.acme.email=<email>@gmail.com
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
      - --entrypoints.websecure.http.tls.certResolver=letsencrypt
      - --entrypoints.websecure.http.tls=true
      - --entrypoints.websecure.http.tls.domains[0].main=domain.com
      - --entrypoints.websecure.http.tls.domains[0].sans=*.domain.com
# --- global redirect to https ---
      - --entrypoints.web.http.redirections.entryPoint.to=websecure
      - --entrypoints.web.http.redirections.entryPoint.scheme=https
    deploy:
      placement:
        constraints: [node.labels.srv1 == web]
      restart_policy:
        condition: on-failure
        delay: 30s
        max_attempts: 3
        window: 180s
      labels:
        - traefik.enable=true
        - traefik.http.routers.api.entrypoints=websecure
        - traefik.http.routers.api.rule=Host(`traefik.domain.com`)
        - traefik.http.routers.api.service=api@internal
        - traefik.http.services.api.loadbalancer.server.port=8080
        - traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://login.domain.com/
        - traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true
        - traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User, Remote-Groups, Remote-Name, Remote-Email
    ports:
      - "80:80"
#      - "8080:8080"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /mnt/usbdisk/data/appdata/traefik-rp/traefik.ymal:/etc/traefik/traefik.ymal
      - /mnt/usbdisk/data/appdata/traefik-rp/letsencrypt:/letsencrypt
      - /mnt/usbdisk/data/appdata/traefik-rp/configurations:/configurations
    environment:
      - CLOUDFLARE_EMAIL=/run/secrets/cloudflare_email_address
      - CLOUDFLARE_DNS_API_TOKEN=/run/secrets/cloudflare_dns_api_token
    networks:
      - traefik
    secrets:
      - cloudflare_email_address
      - cloudflare_dns_api_token

networks:
  traefik:
    attachable: true
    name: traefik

secrets:
  cloudflare_email_address:
    file: /mnt/usbdisk/data/secrets/cloudflare_email_address
  cloudflare_dns_api_token:
    file: /mnt/usbdisk/data/secrets/cloudflare_dns_api_token

version: "3.8"
services:
  portainer:
    image: authelia/authelia
    volumes:
      - /mnt/usbdisk/data/appdata/authelia-rp:/config
    environment:
      - TZ=Europe/Berlin
      - AUTHELIA_JWT_SECRET_FILE=/run/secrets/authelia_jwt_secret
      - AUTHELIA_SESSION_SECRET_FILE=/run/secrets/authelia_session_secret
      - AUTHELIA_NOTIFIER_SMTP_PASSWORD_FILE=/run/secrets/authelia_notifier_smtp_password
      - AUTHELIA_DUO_API_SECRET_KEY_FILE=/run/secrets/authelia_duo_api_secret_key
      - AUTHELIA_STORAGE_MYSQL_PASSWORD_FILE=/run/secrets/authelia_storage_mysql_password
    deploy:
      placement:
        constraints: [node.labels.srv1 == web]
      restart_policy:
        condition: on-failure
        delay: 30s
        max_attempts: 2
        window: 120s
      labels:
        - 'traefik.enable=true'
        - 'traefik.http.routers.authelia.entrypoints=websecure'
        - 'traefik.http.routers.authelia.rule=Host(`login.domain.com`)'
        - 'traefik.http.services.authelia.loadbalancer.server.port=9091'
        - 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://login.domain.com/'
        - 'traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true'
        - 'traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User, Remote-Groups, Remote-Name, Remote-Email'
    networks:
      - traefik
    secrets:
      - authelia_jwt_secret
      - authelia_session_secret
      - authelia_notifier_smtp_password
      - authelia_duo_api_secret_key
      - authelia_storage_mysql_password

networks:
  traefik:
    external: true

secrets:
  authelia_jwt_secret:
    file: /mnt/usbdisk/data/secrets/authelia_jwt_secret
  authelia_session_secret:
    file: /mnt/usbdisk/data/secrets/authelia_session_secret
  authelia_storage_mysql_password:
    file: /mnt/usbdisk/data/secrets/authelia_storage_mysql_password
  authelia_notifier_smtp_password:
    file: /mnt/usbdisk/data/secrets/authelia_notifier_smtp_password
  authelia_duo_api_secret_key:
    file: /mnt/usbdisk/data/secrets/authelia_duo_api_secret_key
  authelia_storage_mysql_password:
    file: /mnt/usbdisk/data/secrets/authelia_storage_mysql_password

I'm not even sure how to approach this issue.

You don't have a service called authelia, you have one called portainer.

Once again thank you so much cakiwi. Everything is working now. I was pulling my hair out for that past few days. Never even thought about checking service name. Need to pay more attention when I copy and paste configs.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.