Docker Community Forums

Share and learn in the Docker community.

How traefik is handling my services if i haven't exposed any port


(Nakwarsi) #1

my problem is a bit conceptual,
here is the scenario…
I created one micro service(Asp.Net Core web Api) and and made a docker image of that service while making that image file i didn’t expose any port in Dockerfile and i run this image using Traefic proxy_server and there as well i didn’t expose any port,
after firing the command docker compose up i am able to consume the service but if inspect the container, i can’t see any port open.
now i am confuse at which port my kestrel server is running and how all this magic happening if I haven’t expose any kind of port from anywhere.

(Mikma) #2

You don’t have to expose ports if you connect to the IP addresses of the containers. The exposed ports are needed if you want to connect to the containers via the host IP address. (The exposed ports are forwarded from the host to the containers.)