Cant change ports in traefik config

Hi everyone,

I'm trying to get a service to run on a different port but it's not working. Any help is appreciated

I have a docker network called proxy and traefik set up already. This is what my docker compose looks like for a container that I'm putting behind traefik.

Any help is appreciated. Thanks.

version: '3'
services:
  trilium:
    image: zadam/trilium
    restart: unless-stopped
    container_name: trilium
    networks:
      - proxy
    ports:
      - 8081:8080
    environment:
      - TRILIUM_DATA_DIR=/home/node/trilium-data
    volumes:
      - /home/user/docker/trilium2:/home/node/trilium-data
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.notes.entrypoints=http"
      - "traefik.http.routers.notes.rule=Host(`notes.local.example.com`)"
      - "traefik.http.middlewares.notes-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.notes.middlewares=notes-https-redirect"
      - "traefik.http.routers.notes-secure.entrypoints=https"
      - "traefik.http.routers.notes-secure.rule=Host(`notes.local.example.com`)"
      - "traefik.http.routers.notes-secure.tls=true"
      - "traefik.http.routers.notes-secure.service=notes"
      - "traefik.http.services.notes.loadbalancer.server.port=8081"
      - "traefik.docker.network=proxy"
networks:
  proxy:
    external: true

It works fine if I remove the
Ports: - 8081:8080 and change load balancer tag to 8080.

The port here needs to be the internal port, that is reached via Docker network.

It has nothing to do with the external port you expose, that is not required, you can remove it.