This is an old revision of the document!


Postgresql import and export database using Docker

PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance. Source

Export database

  1. Login to a system with psql installed
  2.  pg_dump --host=localhost --username=dbloginname --dbname=testdb --file=/tmp/testdb_bac.sql
  3. copy db to destination system

create dockerfile and container

Dockerfile

FROM postgres
COPY fsidb_bac.sql /docker-entrypoint-initd.d/