Error with multiple traefik instances on top of multiple ECS instances

I'm running multiple traefik loadbalancers that routes request to ECS with 60 instances.

REST API / HTTP request works great but my WSS connect returns Peeking first byte error

2024-04-12T04:48:33Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->115.73.125.19:35853: i/o timeout"
2024-04-12T04:48:33Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->171.243.24.154:38229: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->171.226.93.190:36583: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->115.76.201.224:33789: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->115.76.201.224:42961: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->171.226.94.219:43903: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->171.226.93.190:41277: i/o timeout"
2024-04-12T04:48:43Z ERR Error while Peeking first byte error="read tcp 172.17.0.2:443->27.70.163.249:32811: i/o timeout"

I read online that you need to run a docker swarm if you have multiple traefik instance across different ec2 instances and was wondering if there are other ways to do this.

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

Here it is. I figured maybe I need to set up a swarm?

version: '3.8'

services:
  traefik:
    image: traefik:v2.9
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
      - "4650:4650"
      - "4444:4444"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${PWD}/config/traefik.yml:/etc/traefik/traefik.yml
      - ${PWD}/config/dynamic:/etc/traefik/dynamic
      - ${PWD}/config/proxy_wynd_network.crt:/etc/traefik/proxy_wynd_network.crt
      - ${PWD}/config/proxy_wynd_network.key:/etc/traefik/proxy_wynd_network.key
      - ${PWD}/config/acme.json:./acme.json
    environment:
      - HOST_DOMAIN_RULE=${HOST_DOMAIN_RULE}
      - DYNAMIC_MOUNT_PATH=/etc/traefik/dynamic
      - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
      - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
      - AWS_REGION=${AWS_REGION}
      - AWS_CLUSTER=${AWS_CLUSTER}
    env_file:
      - .env
    restart: unless-stopped


There is no Traefik static or dynamic config.

You can run multiple Traefik instances independently, configured them manually for target services on other nodes.

Or you use Docker Swarm for automatic configuration discovery across multiple nodes. Check simple Traefik Swarm example.

It's on my DockerFile. As you can see, I mount the static and dynamic config.

In my static config, I use ecs provider. Can I both use ecs and swarm provider without any issues?

You should be able to use multiple providers in parallel.

In Traefik v2 you had to enable swarm on Docker provider, in Traefik v3 there is a separate docker and swarm provider to be able to detect local and swarm services/containers at the same time.

I configured the docker provider but I'm now getting this

connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

Is the Docker daemon running on the node?

Try docker ls.

Did you mount Docker socket into the container?