Created
February 26, 2018 23:40
-
-
Save ddrscott/2334876fdf3f73045a7c5fcccff6fee1 to your computer and use it in GitHub Desktop.
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
| FROM postgres:9.3-alpine | |
| # Build scratch.sql by running: | |
| # $ pg_dump --no-owner --no-acl scratch > scratch.sql.gz | |
| COPY scratch.sql /docker-entrypoint-initdb.d/ |
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
| # Change to gist directory | |
| cd /path/to/scratch-pg93 | |
| # Build the Image | |
| docker build -t scratch-pg93 . | |
| # Start PG server listening to 25432 | |
| docker run -it --rm -p 25432:5432 scratch-pg93 | |
| # List table | |
| docker run -it --rm scratch-pg93 psql -h docker.for.mac.localhost -p 25432 -U postgres -c '\d' | |
| # Connect to it | |
| docker run -it --rm scratch-pg93 psql -h docker.for.mac.localhost -p 25432 -U postgres | |
| # docker.for.mac.localhost can be changed to localhost on Linux hosts. | |
| docker run -it --rm scratch-pg93 psql -h localhost -p 25432 -U postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment