Obviously I get an error from docker saying Bind for 0.0.0.0:80 failed: port is already allocated. Either exposing the port 80 of the traefik service or the api service separately works perfectly. If I do not expose the port 80 on those both services it does not work for both of them. The app service which runs on Nginx works without exposing port 80 seamlessly. How can I make the api and traefik service both run together on port 80?
you don't need to expose the port of your service named api, you just need to define the port of the related service: traefik.http.services.<name>.loadbalancer.server.port=<port number>
@ldez Thank you for your effort! I dont know why but this does not seam to work in my case. I am also wondering why there is a difference between the app service and the api. The app is Nginx and the api is a node container. Here is my repo:
@ldez Yes I think you are right this is probably my network setup. So I tried to add the label - traefik.docker.network=web to the api to tell traefik that it should use this network instead of the internal but this does not seam to work. What am I doing wrong here?
I probably should just use one network and use Traefik for securing the database. Is there any boilerplate with a Traefik docker compose setup I can take a look at?