It is possible to docker-compose to forward a port to the container from
localhost only, by writing the desired
ports configure in
In docker swarm this does not work and the published port is visible from the internet.
How then can I access the container port only from localhost without opening the port to the internet?
I tried configuring iptables to deny connection to port
iptables -A INPUT -p tcp --dport 5432 -j DROP, but because of the settings from docker for iptables, that didn't work.