Reputation: 185
I have two apps in docker:
Now I have domain.com.
I want to redirect:
I tried to read the documentation and tried but had no success. The container for App A and B are running. The Traefik says to use docker compose as one way but I just want to keep the old container. Do I directly run the Traefik ./traefik --configFile=traefik.toml
which is one of the way with config file.
I am not sure what to add to the config.
Upvotes: 0
Views: 1240
Reputation: 137
Have you checked the documentation of Traefik's docker backend?
You can configure the URL at which you expose the apps via a label on the container itself. For instance if you are using docker-compose, you can add something like this:
labels:
traefik.frontend.rule: Host:appa.domain.com
traefik.enable: "true"
Upvotes: 1
Reputation: 914
If you would like to go ahead with Nginx, I'll suggest you go ahead with jwilder's Nginx Reverse Proxy which will help you do the same thing with Nginx instead of Traefik.
All you need to do is simply run the Nginx reverse proxy container once. After that whenever you spin, say App A all you'll need to do is pass an extra variable in the command like docker run -e VIRTUAL_HOST=appa.domain.com ...
for every container
Upvotes: 1