Docker Community Forums

Share and learn in the Docker community.

Docker Bridge Netfilter nftables acces to PostgreSQL

Hi,
I have a docker for my postgreSQL in a brdge docker configuration.
I need to add an nftables rule to access to my postgreSQL from a client (HeidiSQL or pgadmin)

Do you know what is the rule i have t add please ?

I tried something like that
in chain PREROUTING
iif “eth0” tcp dport 5432 dnat to 172.17.0.5:5432

it doesn’t work…

Thank you.

Please visit the Docker Hub, and see that what is there is known as Docker Image, and it is basically the skeleton of the container (model).

Docker Images are generated by Dockerfiles, and they contain all the information needed to create a container, in order to make it easy to maintain and customize.

If you look with attention into the Docker Hub, it’s easy to see that the PostgreSQL image, called postgres, have different tags and versions, and if you don’t specify one of them the default will be used, the latest, but maybe in the future if you need different containers of PostgreSQL working together, you may want them to be in the same version.

Let’s create our first right container now, remember the need for the argument ‘–network’, or it will be deployed in the default bridge.