# Docker instance of Traefik shutting down on it's own

**URL:** https://community.traefik.io/t/docker-instance-of-traefik-shutting-down-on-its-own/17014
**Category:** Traefik v2
**Tags:** docker
**Created:** [January 4, 2023, 7:39pm UTC](https://community.traefik.io/t/docker-instance-of-traefik-shutting-down-on-its-own/17014 "2023-01-04T19:39:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gustavodeon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gustavodeon/32/6439_2.png) [@gustavodeon](https://community.traefik.io/u/gustavodeon)
#### Post date: [January 4, 2023, 7:39pm UTC](https://community.traefik.io/t/docker-instance-of-traefik-shutting-down-on-its-own/17014/1 "2023-01-04T19:39:18Z")

</div>

Hey there, i'm setting up my homelab with Traefik, simple reverse proxy from subdomain to internal ports through a docker network, but when i leave my instance of Traefik up for a long-ish period of time it stops itself out of nowhere, here are my docker-compose for traefik, a service i'm running that is proxied by traefik for example of usage and the log at shutdown moment:

Traefik:

```auto
version: '3'
services:
  traefik:
    image: "traefik:latest"
    container_name: "traefik"
    command:
      - "--log.level=DEBUG"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.network=reverseproxy-nw"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      
      #- "--entrypoints.websecure.address=:443"

      # cert resolver
      #- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
      #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-v02.api.letsencrypt.org/directory"
      #- "--certificatesresolvers.myresolver.acme.email=email@example.com"
      #- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "443:443"
      - "80:80"
      - "8080:8080"
    volumes:
      - "/home/gustavo/aplications/traefik/letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dashboard.rule=Host(`traefik.domain.com`)"
      - "traefik.http.routers.dashboard.entrypoints=web"
      - "traefik.http.services.dashboard.loadbalancer.server.port=8080"
    networks:
      - reverseproxy-nw
    
networks:
  reverseproxy-nw:
    name: reverseproxy-nw
    external: true

```

**PS:** Commented lines are for enabling SSL certificates once i can lay down the foundation and iron out all the "unwanted behaviours".

Portainer:

```auto
version: '3.3'
services:
    portainer:
        labels:
            - "traefik.http.routers.portainer.rule=Host(`portainer.domain.com`)"
            - "traefik.http.routers.portainer.entrypoints=web"
            - "traefik.http.services.portainer.loadbalancer.server.port=9000"
            - "traefik.enable=true"
        container_name: portainer
        command: -H unix:///var/run/docker.sock
        ports:
            - '8000:8000'
            - '9000:9000'
        restart: always
        volumes:
            - '/var/run/docker.sock:/var/run/docker.sock'
            - './portainer_data:/data'
        image: portainer/portainer-ce
        environment:
            - VIRTUAL_HOST=portainer.domain.com
            - VIRTUAL_PORT=9000
        networks:
            - reverseproxy-nw

networks:
  reverseproxy-nw:
    external: true

```

Logs for the moment of shutdown:

```auto
time="2023-01-03T17:34:12Z" level=error msg="Error while Peeking first byte: read tcp 172.25.0.3:80->200.71.120.196:42276: read: connection timed out"
time="2023-01-03T17:59:52Z" level=debug msg="'499 Client Closed Request' caused by: context canceled"
time="2023-01-03T18:32:27Z" level=info msg="I have to go..."
time="2023-01-03T18:32:27Z" level=info msg="Stopping server gracefully"
time="2023-01-03T18:32:28Z" level=debug msg="Waiting 10s seconds before killing connections." entryPointName=traefik
time="2023-01-03T18:32:28Z" level=debug msg="Waiting 10s seconds before killing connections." entryPointName=web
time="2023-01-03T18:32:28Z" level=error msg="accept tcp [::]:8080: use of closed network connection" entryPointName=traefik
time="2023-01-03T18:32:28Z" level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2023-01-03T18:32:28Z" level=error msg="close tcp [::]:80: use of closed network connection" entryPointName=web
time="2023-01-03T18:32:28Z" level=debug msg="Entry point web closed" entryPointName=web
time="2023-01-03T18:32:28Z" level=error msg="close tcp [::]:8080: use of closed network connection" entryPointName=traefik
time="2023-01-03T18:32:28Z" level=debug msg="Entry point traefik closed" entryPointName=traefik
time="2023-01-03T18:32:28Z" level=info msg="Server stopped"
time="2023-01-03T18:32:28Z" level=info msg="Shutting down"

```

I've placed a few lines before so it shows that there are no prior messages that would explain that behaviour.

I've tried to understand what is causing it from the code but my go skills are questionable at best 😕.

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [January 5, 2023, 6:03pm UTC](https://community.traefik.io/t/docker-instance-of-traefik-shutting-down-on-its-own/17014/2 "2023-01-05T18:03:50Z")

</div>

Can you make sure to run the latest release, either by using a [release tag](https://doc.traefik.io/traefik/deprecation/releases/) or running a `docker pull` on the `latest` image.

If the problem still exists, I would open an issue on [GitHub](https://github.com/traefik/traefik).

---

<div class="post-metadata">

### Author: ![gustavodeon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/gustavodeon/32/6439_2.png) [@gustavodeon](https://community.traefik.io/u/gustavodeon)
#### Post date: [January 5, 2023, 7:38pm UTC](https://community.traefik.io/t/docker-instance-of-traefik-shutting-down-on-its-own/17014/3 "2023-01-05T19:38:28Z")

</div>

Thanks for the reply, I forgot about placing the version being used, currently the image is on version 2.9.6.

I thought about opening an issue on GitHub but wanted to make sure it wasn't something obvious I was missing 😅. I'll go ahead and open one, thanks!
