Last active
June 3, 2017 10:43
-
-
Save ataube/d2d8889a3652fd5eb81e504ed2c33358 to your computer and use it in GitHub Desktop.
Revisions
-
Andreas Taube revised this gist
Jun 3, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,8 @@ This pattern can be applied to other (host) services as well. - `vi /usr/local/var/postgres/pg_hba.conf` - add `host all all 10.200.10.1/32 trust` # Usage `docker run --rm -it -e POSTGRES_URL=postgres://[email protected]:5432/myDB ataube/myImage` More infos here: -
Andreas Taube revised this gist
Jun 3, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ This pattern can be applied to other (host) services as well. - add `listen_addresses = '127.0.0.1,10.200.10.1'` 4. Trust the new ip - `vi /usr/local/var/postgres/pg_hba.conf` - add `host all all 10.200.10.1/32 trust` -
Andreas Taube created this gist
Jun 3, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ The following steps explain a workaround to connect from a container to a postgres server installed on the host system. This pattern can be applied to other (host) services as well. # Setup 1. Install postgres - `brew install postgres` - `brew services start postgres` (https://github.com/Homebrew/homebrew-services) 2. Attach a unused IP to the local lo0 interface `sudo ifconfig lo0 alias 10.200.10.1/24` 3. Bind the postgres server to the new ip - `vi /usr/local/var/postgres/postgresql.conf` - add `listen_addresses = '127.0.0.1,10.200.10.1'` 4. Trust the new ip - `vi /usr/local/var/postgres/pg_hba.conf - add `host all all 10.200.10.1/32 trust` More infos here: https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds