Last active
October 11, 2017 19:31
-
-
Save evaldosantos/47057ee3934b7ad9e1b9ea10c25deb71 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
// 1 - (host step) - create a new container | |
$APPNAME="db" | |
docker run -d --name $APPNAME -v $APPNAME:/var/lib/postgresql/data -e POSTGRES_PASSWORD=1234 -p 5432:5432 postgres:9.4-alpine | |
// after that, the container will be running in detached mode | |
// 2- (host step) So, you connect to it | |
docker exec -it $APPNAME /bin/bash | |
// 3 - (host step) copy file to container, here $APPNAME is the name of running container | |
docker cp dumpfile $APPNAME:/tmp | |
// 4 - once you are inside the container (step 2), run the command below | |
# PGPASSWORD=$DB_PASS pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d postgres /tmp/dumpfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker run -d --name back -v /path/to/back:/code:Z -p 9999:9999 --link db:db back