I noticed that in the docker-compose.yml the port of the postgresdb is exposed. When you link the containers as it's done in the compose file, that's not necessary for the app container to access the db. containers inside a stack can (almost) always talk to each other. The only advantage is that it would be possible to use an external app to access the db like pgadmin. From a security point of view, I would argue against exposing the port, at least not in a production environment.
I noticed that in the docker-compose.yml the port of the postgresdb is exposed. When you link the containers as it's done in the compose file, that's not necessary for the app container to access the db. containers inside a stack can (almost) always talk to each other. The only advantage is that it would be possible to use an external app to access the db like pgadmin. From a security point of view, I would argue against exposing the port, at least not in a production environment.