Docker: Let containers communicate to each other but don't expose to internet
If you're looking to access your database only from localhost, you can do something like that:
    ports:
      - &quot;127.0.0.1:5432:5432&quot;