Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save gokman/cc394c8d16e16955b7f411e9a2c1ff05 to your computer and use it in GitHub Desktop.

Select an option

Save gokman/cc394c8d16e16955b7f411e9a2c1ff05 to your computer and use it in GitHub Desktop.
create image and container from postgresql dockerfile
#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