Docker Compose + Postgres: Expose port

本秂侑毒 提交于 2019-12-05 15:09:16

Just map the port to the host machine, add this to the db service in your Compose file:

ports:
  - "5432:5432"

Also make sure to set the postgres password variable in the compose file like this

environment:
  POSTGRES_PASSWORD: example

The default user is postgres, you can change it with the POSTGRES_USER variable.

You can read about the usage of the image with all options here: https://hub.docker.com/_/postgres/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!