Docker Community Forums

Share and learn in the Docker community.

DSTNAT without binding, is it possible

In order for me to be able to flexibly change the exposed port, I tried to create a container with exposed port 80 on local with a fixed ip address.

And have a dstnat rule to point an external request to the local container
DNAT tcp – anywhere WANIP tcp dpt:26080 to:172.11.0.241:80
(172.11.0.241 is the ip of the container)

The expose in Dockerfile seems to be working
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3b3c29498c0 expressjs/node:lts “/home/shell.sh” 10 minutes ago Up 10 minutes 80/tcp express

But I seems not to be able to access it from outside even when I have the same masquerade rule as the docker0 network.

What other rules do I need to add for the translate to work?
Thanks.