Use of closed network connection

I got these errors when I try to start traefik for the first time :

traefik | 2024-07-03T20:32:27+02:00 ERR error="accept tcp [::]:443: use of closed network connection" entryPointName=https
traefik | 2024-07-03T20:32:27+02:00 ERR error="accept tcp [::]:80: use of closed network connection" entryPointName=http
traefik | 2024-07-03T20:32:27+02:00 ERR error="close tcp [::]:80: use of closed network connection" entryPointName=http

I opened the ports on my router (Unifi Network) and when using public ip + 80 or 443 on a port checker website it says the ports are open.

Here is what my docker-compose.yml file looks like :

version: "3.5"
services:
  traefik:
    image: traefik
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - external_proxy
    ports:
      - 800:80
      - 4443:443
      - 8060:8080
    environment:
      - CF_API_EMAIL=***
      - CF_DNS_API_TOKEN=***
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /volume2/docker/appdata/traefik/traefik.yml:/traefik.yml:ro
      - /volume2/docker/appdata/traefik/acme.json:/acme.json
      - /volume2/docker/appdata/traefik/config.yml:/config.yml:ro
      - /volume2/docker/appdata/traefik/logs:/var/log/traefik
    labels:
      - traefik.enable=true
      - traefik.http.routers.traefik.entrypoints=http
      - traefik.http.routers.traefik.rule=Host(`traefik-dashboard.mydomain.com`)
      - traefik.http.middlewares.traefik-auth.basicauth.users=*****
      - traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https
      - traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https
      - traefik.http.routers.traefik.middlewares=traefik-https-redirect
      - traefik.http.routers.traefik-secure.entrypoints=https
      - traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.mydomain.com`)
      - traefik.http.routers.traefik-secure.middlewares=traefik-auth
      - traefik.http.routers.traefik-secure.tls=true
      - traefik.http.routers.traefik-secure.tls.certresolver=cloudflare
      - traefik.http.routers.traefik-secure.tls.domains[0].main=mydomain.com
      - traefik.http.routers.traefik-secure.tls.domains[0].sans=*.mydomain.com
      - traefik.http.routers.traefik-secure.service=api@internal
networks:
  external_proxy:
    external: true

I have this in traefik.yml :

api:
  dashboard: true
  debug: true
entryPoints:
  http:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: https
          scheme: https
  https:
    address: ":443"
serversTransport:
  insecureSkipVerify: true
providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
    network: external_proxy
  file:
    filename: /config.yml
certificatesResolvers:
  cloudflare:
    acme:
      email: ****@gmail.com
      storage: acme.json
      dnsChallenge:
        provider: cloudflare
        #disablePropagationCheck: true # uncomment this if you have issues pulling certificates through cloudflare, By setting this flag to true disables the need to wait for the propagation of the TXT record to all authoritative name servers.
        resolvers:
          - "1.1.1.1:53"
          - "1.0.0.1:53"

I have an empty config.yml file
I have an empty logs folder
I have created empty acme.json file (which got populated with my cloudflare info when i started the container)

Any idea what would be the issue?

I managed to access the dashboard by adding a new entrypoint:

In docker-compose :

  • traefik.http.routers.dashboard.entrypoints=traefik

in traefik.yml :

api:
  dashboard: true
  insecure: true # added this
  debug: true
entryPoints:
  http:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: https
          scheme: https
  https:
    address: ":443"
  traefik: # added this
    address: ":8080" # added this

Now I can access the dashboard at 10.10.2.2:8060

But I still have the error message as previously, except now I have one more for the new entrypoint.

usually only happens when a Traefik container is shut down. Make sure it's not an "old" message from last container shutdown.