Simple configuration for container with two open ports

Hi there,
I'm a new user and I have a question about ability to use an one docker container with two ports.

So...
https://hub.docker.com/_/traefik

1. I create a file traefik.yml

# Docker configuration backend
providers:
  docker:
    defaultRule: "Host(`{{ trimPrefix `/` .Name }}.my.superdomain.com`)"

# API and dashboard configuration
api:
  insecure: true

2. I started the Traefik proxy. My an app use two ports: 80 and 88

docker run -d -p 8080:8080 -p 80:80 -p 88:88  -v $PWD/traefik.yml:/etc/traefik/traefik.yml  -v /var/run/docker.sock:/var/run/docker.sock  traefik:v2.0

3. And I started my an app with --name xxx.

docker run -d --expose 80 --expose 88 --name xxx myapp:v1.2 bash

Now I go to http://xxx.my.superdomain.com and see my an app (a service 1 working on port 80), but if I go to http://xxx.my.superdomain.com:88 my browser say me "This site can’t be reached".

And my a question is: How to configure Traefik so that the site runs on port 80 and 88 from one docker container?

There is documentation at https://docs.traefik.io. For you particular problem https://docs.traefik.io/routing/entrypoints/ and https://docs.traefik.io/routing/routers/ is a good start, but read through "Getting Started" too. Come back if anything is unclear.

1 Like