# Docker container with dual ports/paths

**URL:** <https://community.traefik.io/t/docker-container-with-dual-ports-paths/21935>\
**Category:** Traefik v2\
**Tags:** letsencrypt-acme, docker\
**Created:** [March 20, 2024, 5:42pm UTC](https://community.traefik.io/t/docker-container-with-dual-ports-paths/21935 "2024-03-20T17:42:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![4integration](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/4integration/32/2812_2.png) [@4integration](https://community.traefik.io/u/4integration)\
**Post date:** [March 20, 2024, 5:42pm UTC](https://community.traefik.io/t/docker-container-with-dual-ports-paths/21935/1 "2024-03-20T17:42:17Z")

</div>

Hi,

I have Traefik (2.10.4) running since a while and mainly to Docker containers with Let's Encrypt.

Now I have a container which listen on two ports and I cannot figure out how to it the proper way.

- Port `6749` has a path `/admin` (and everything below that path) it listen on (admin UI)
- Port `8443` handles all other request/paths

So I want Traefik to:

- [https://auth.myorg.net/admin/](https://auth.myorg.net/admin/)\* to be routed to port 6749
- [https://auth.myorg.net/](https://auth.myorg.net/)\* to be routed to port 8443

`docker-compose.yml` (not working)

```auto
version: '3.9'
services:
  fancy_container:
    image: the_fancy_image
    container_name: fancy_container
    ports:
      - 6749:6749
      - 8443:8443
    labels:
      - traefik.enable=true
      - traefik.http.services.admin_service.loadbalancer.server.port=6749
      - traefik.http.services.admin_service.loadbalancer.server.scheme=https
      - traefik.http.routers.admin_service.rule=Host(`auth.myorg.net`)
      - traefik.http.routers.admin_service.tls=true
      - traefik.http.routers.admin_service.tls.certresolver=le
      - traefik.http.routers.admin_service.service=admin_service
      - traefik.http.routers.admin_service.middlewares=ipwhitelist
      - traefik.http.routers.admin_service.rule=Path(`/admin`)

      - traefik.http.middlewares.ipwhitelist.ipwhitelist.sourcerange=127.0.0.1/24, 192.168.1.1/24
    networks:
      - web
    restart: always
networks:
  web:
    name: web
    external: true

```

Do you have any solution on this?

---

<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:** [March 20, 2024, 8:55pm UTC](https://community.traefik.io/t/docker-container-with-dual-ports-paths/21935/2 "2024-03-20T20:55:45Z")

</div>

This is easy, but are you sure it’s gonna work with your application?

One port seems to be a GUI and those usually don’t like to be be placed under a path, as they mostly respond with absolute links to scripts (`/static/script.js`) and images, so those won’t be found.

Example: Traefik dashboard 😉

Can some kind of "base path" be configured for the app? If not, you need separate sub-domains.

---

<div class="post-metadata">

**Author:** ![4integration](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/4integration/32/2812_2.png) [@4integration](https://community.traefik.io/u/4integration)\
**Post date:** [March 21, 2024, 5:51pm UTC](https://community.traefik.io/t/docker-container-with-dual-ports-paths/21935/3 "2024-03-21T17:51:19Z")

</div>

@bluepuma77 easy sound good but not for me right now 😉

If I run the application (an OAuth2/OIDC provider) it listen on two ports of interest

- Port `6749`
  - Here it only accept traffic on sub path `/admin`

- Port `8443`
  - Here it is accepting on "all" other paths like `/token/internal/authorize` and `/token/internal/token`

Would be very happy with help on the easy solution with Traefik 😉  
(We have this running in the company I work for but using HAProxy, for this case I have Traefik so would use that)
