Simple TCP load balancing on docker swarm

Hi I am trying too spin up traefik with simple tcp load balancing and I get an error

time="2023-03-20T23:33:23Z" level=error msg="service \"mog-traefik\" error: port is missing" providerName=docker container=mog-traefik-ziac72cznhf9u39p07la9jm33

Below is my docker compose file

version: "3.7"

services:
  app:
    image: oguzpastirmaci/hostname
    deploy:
      replicas: 3
      labels:
        - "traefik.enable=true"
        - "traefik.docker.network=web"
        - "traefik.tcp.routers.myapp.rule=HostSNI(`myapp.local`)"
        - "traefik.tcp.routers.myapp.entrypoints=tcp"
        - "traefik.tcp.services.myapp.loadbalancer.server.port=3000"
    ports:
      - "3000:8000"

  traefik:
    image: traefik:v2.5
    command:
      - "--api.insecure=true"
      - "--api.dashboard=true"
      - "--providers.docker=true"
      - "--providers.docker.swarmmode=true"
      - "--providers.docker.endpoint=unix:///var/run/docker.sock"
      - "--entrypoints.tcp.address=:11034"
    ports:
      - "80:80"
      - "8080:8080"
      - "11034:11034"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      - web

networks:
  web:

When using Docker Swarm you need to set loadbalancer.server.port, otherwise Traefik does not know the internal port to forward to, see docs.

Do you have other containers running? You have not set exposedByDefault to false, see docs.

Note that HostSNI() normally only works with TLS/SSL connections. For plain TCP I think you need to set domain to * to match any connection incoming. Maybe use HostSNIRegexp(`*`), see docs.

PS: update Traefik to v2.9, v3 is almost ready.