Created
May 16, 2017 06:00
-
-
Save gokman/cc394c8d16e16955b7f411e9a2c1ff05 to your computer and use it in GitHub Desktop.
create image and container from postgresql dockerfile
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
| #create image | |
| docker build -t {image_name} -f Dockerfile . | |
| #create container | |
| docker run -d -p 5433:5432 --name {container_name} {image_name} | |
| #start container | |
| docker start {container_name} | |
| #go into the shell of the container | |
| docker exec -i -t {container_name} /bin/bash | |
| #login as postgres user | |
| su postgres | |
| #execute related sql files for building database | |
| cd sql | |
| psql -f create.sql | |
| psql -f insert.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment