Created
August 18, 2024 21:50
-
-
Save NeoHBz/deb172d1b913c4cd5f9e4901c92282b1 to your computer and use it in GitHub Desktop.
Docker - access Postgres on Host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
service_name: | |
image: image_uri | |
ports: | |
- "host_port:docker_port" | |
extra_hosts: | |
- "host.docker.internal:172.17.0.1" # obtained using $ ifconfig docker0 | |
# network_mode: "host" # this is no longer needed | |
environment: | |
DATABASE_URL: postgresql://user:[email protected]:5432/db | |
DATABASE_TYPE: postgresql | |
# also make sure postgres configs accept connections from "*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment