Friday 1 March 2019

Docker dump postgres container

After running docker run su - postgres and use below command.
-bash-4.2$ pg_dump -U {username of the selected db} {dbname} -f /tmp/{file name whatever you want}.sql
next execute below to see this dump file generated or not
-bash-4.2$ cd /tmp/
-bash-4.2$ ls
once confirm
open another terminal and make sure docker is running and execute below commend to copy dump file into physical file in your desktop
sudo docker cp {docker name}:/tmp/{file name of the sql file} ~/
https://stackoverflow.com/questions/49891867/generating-a-dump-file-from-postgresql-database-inside-a-docker-container

No comments:

Post a Comment