Skip to content

Unable to handle expose-range syntax in docker-compose #13146

@philipwhiuk

Description

@philipwhiuk

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

Define a docker container that exposed a port range with traefik configuration in docker-compose alongside Traefik.
Ran docker compose up.

Expected Traefik to route requests to ws subdomain port 8000

What did you see instead?

time="2026-05-11T11:16:07Z" level=warning msg="Failed to inspect container 58667437d0991c8b207a6a4d9190268a26ac505011af55f5fb0be96e82956d8c, error: invalid port '12000-13000': invalid syntax" providerName=docker

What version of Traefik are you using?

2.11.45

What is your environment & configuration?

  ws:
    container_name: ws
    pull_policy: always
    restart: always
    depends_on: [ traefik ]
    image: registry.internal.com/ws/ws:latest
    ....
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ws.rule=Host(`fixbridge.${SERVER}.platform.flextrade.cloud`)"
      - "traefik.http.routers.ws.entrypoints=web"
      - "traefik.http.routers.ws.service=ws"
      - "traefik.http.services.ws.loadbalancer.server.port=8080"
      - "traefik.frontend.entryPoints=http,https"
    expose:
      - "12000-13000"
  traefik:
    container_name: traefik
    pull_policy: always
    restart: always
    image: "traefik:v2.11"
    ports: [ "80:80" ]
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--accesslog=true"
      - "--log.level=DEBUG"
    volumes: [ "$XDG_RUNTIME_DIR/docker.sock:/var/run/docker.sock:ro" ]

Other Notes

It works correctly when removing the expose config

    expose:
      - "12000-13000"

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions