Skip to content

Instantly share code, notes, and snippets.

@paulomcnally
Last active October 22, 2019 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulomcnally/07b2786e1b5878b96201e15fbdd87e36 to your computer and use it in GitHub Desktop.
Save paulomcnally/07b2786e1b5878b96201e15fbdd87e36 to your computer and use it in GitHub Desktop.
docker exec ubuntu_postgres_1 createdb my_database -U postgres
version: '3'
volumes:
postgres-data:
driver: local
services:
postgres:
image: postgres:10.10
ports:
- 5432:5432
restart: always
environment:
POSTGRES_PASSWORD:
volumes:
- /home/ubuntu/ftp/postgres/dumps:/db/dumps
- postgres-data:/var/lib/postgresql/data
docker exec ubuntu_postgres_1 dropdb -U postgres my_database
docker exec ubuntu_postgres_1 pg_restore --verbose --clean --no-acl --no-owner -U postgres -d my_database /db/dumps/latest.dump
docker exec ubuntu_postgres_1 pg_restore --verbose --clean --no-acl --no-owner -U postgres -d my_database --schema=public /db/dumps/latest.dump
docker exec ubuntu_postgres_1 createdb -T my_database new_my_database -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment