When I call the command docker ps
all my running docker containers are listed. Among other things, the port mappings are displayed in the PORTS column.
I can't figure out what the difference is between this notation: 5432/tcp and that notation: 0.0.0.0:5432->5432/tcp.
5432/tcp means port 5432 is exposed of the container
When you EXPOSE 5432 (or any port you want) in your Dockerfile that’s going to tell Docker that your container’s service can be connected to on port 5432 of the container.
0.0.0.0:5432->5432/tcp means host port 5432 is mapped to container port 5432
When you publish any port, any traffic that comes on the host port will be forwarded to the published container port.