Skip to content

Instantly share code, notes, and snippets.

@encoreshao
Created April 28, 2017 09:28
Show Gist options
  • Save encoreshao/2f46448118b34220066e45f91956c447 to your computer and use it in GitHub Desktop.
Save encoreshao/2f46448118b34220066e45f91956c447 to your computer and use it in GitHub Desktop.
How to create a basic docker image on a Mac
1. Write Dockerfile
Download PG9.6 - Dockerfile (https://gist.github.com/encoreshao/3859bffca218994bb26a82015f76f150)
2. Make a docker image command
> Docker build --rm = true -t postgres: 9.6.
3. Run PostgreSQL On Docker - (5433: 5432) Local Port 5433 Mapping 5432 in docker
> Docker run -i -t -p 5433: 5432 postgres: 9.6
4. Test
> Psql -h localhost -p 5433 -U docker
Password for user docker:
Psql (9.6.2)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
Docker = # \ l
                              List of databases
   Name | Owner | Encoding | Collate | Ctype | Access privileges
----------- + ---------- + ---------- + --------- + ------ --- + ------------------------
 Docker | docker | UTF8 | C.UTF-8 | C.UTF-8 |
 Postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
 Template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | = c / postgres +
           Postgres = CTc / postgres
 Template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | = c / postgres +
           Postgres = CTc / postgres
(4 rows)
Docker = #
Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment