Traefik not routing a NGINX Container

34 http services and 32 routers are running on my server and everything is working perfectly, I decided to run a simple ngnix container to serve a simple HTML page, here is the configuration of the ngnix:
version: '3'


enable connection with Traefik

external: true

container_name: cv-mr-elamin
image: nginx:latest
- '80'
- traefik
- "traefik.enable=true"
- ""
- ""
- ""
- ""

when I run the container: "docker compose -p cv up -d" I get this log in the output:

the container got the IP and seems to be NGNIX is running correctly, as you see when I test the NGINX Server by IP "curl" the page is getting loaded but when I test the server per hostname "curl" I am getting the answer 404, DNS resolve is also okay. also, I don't see the router or the service coming up on the dashboard.

maybe someone has an idea to figure out this problem?
Thanks a lot.

Use 3 backticks in front and after config to format. In yaml every space matters.

Share your full Traefik static and dynamic config, and Docker-compose.tml if used.

Why can you curl the nginx container from host when you have not exposed any ports?

Hi BluePuma,
Thank you very much for your reply.
I'm using VS Code, so I can see any mistakes in spaces.
here is a screenshot from the full Traefik compose file:

and here is a screenshot from the full NGNIX compose file, I have exposed port 80 in the container:

for a troubleshooting purpose, I have updated the file /etc/hosts with the DNS name of my site "" and with the IP address of the container "172.18.48" The curl test was successful without going through Traefik, but when I remove the DNS entry from /etc/hosts, the request will go through Traefik and I get a reply 404.

I have a lot of other containers running on the same server, and all of them are fine, except this one, I changed the NGINX version with another image, but still I have the same problem.

Maybe start by using a recent Traefik image, not one from Sep 7, 2020.

Why can you curl the nginx container from host when you have not exposed any ports? The nginx container should not be listening on any ports reachable outside of Docker.

Hi BluePuma,
Thank you very much for your reply,
I have just started using Traefik V2.11 instead of V2.2 but still I have the same problem.
I have no idea actually why the NGNIX Container is reachable on port 80 from the host although I have mapped only Traefik port 80 to port 80 on the host.
here's a screenshot from "docker ps" for both Traefik and NGINX

and here's a screenshot from the network part of the NGINX docker inspect:

and here are two screenshots from the network part of the Traefik docker inspect:

Port 80 is exposed by default as I created today a new virtual machine for testing without anything rather than NGINX and Traefik. everything is the same.

With Docker CE, no ports are automatically opened. Expose just indicates which ports to use, but you need to explicitly use ports to create a listening port (publish) on the host.

Hi BluePuma,
Thank you very much for your reply, I appreciate that!
Everything now is working fine and the router has appeared on the Dashboard, but I don't have any idea why it is now working and why didn't work before.!!!
Maybe there's a delay on Traefik to create the new routers, I worked for long hours on Friday with no luck, and today Sunday everything is working without doing anything extra.

I'm using Docker CE Version 24.0.7
All my Webservers Apache and NGINX have port 80 exposed to the host without describing that in the file docker-compose.yaml explicitly. All other ports rather than 80 I have to expose them in the expose section of the docker-compose.yaml file to make the port accessible from other containers but not from the host.

I think when docker ps just shows 80/tcp, then it’s not really listening, but only showing expose. It needs to indicate the IP with a :, potentially empty when listening to all.

Check with netstat -tulpn which ports are really open.

Sidenote: you can’t have multiple container listening on the same port on the host.