I have a docker compose file which is setup up so that each container can have access to 2 networks (frontend or backend) such that
services:
frontend:
image: whatever:latest
networks:
- front
backend:
image: whatever:latest
ports:
- "7233:7233"
networks:
- back
middle:
image: whatever:latest
networks:
- back
- front
networks:
front:
driver: bridge
back:
driver: bridge
I have set up a tcmdump inside the container on port 7233 and can see packets coming in if I hit the port from another container.
However if I try and hit the port from outside – from the host – then I see no packets.
My understanding is this :
If you have 2 networks then the container will have 2 virtual ethernet adapters.
The port mapping in docker compose will bind the port as LISTEN on ALL available adapters.
I have tcpdumped on both adapters and only 1 is receiving packets, and then only if the traffic originates from within the container network, i.e. from another container.
How can I get the external route to work as well?