如何从Docker容器生成Postgresql转储? [英] How to generate a Postgresql Dump from a Docker container?
本文介绍了如何从Docker容器生成Postgresql转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想有一种进入Postgresql容器并从中获取数据转储的方法。
I would like to have a way to enter into the Postgresql container and get a data dump from it.
推荐答案
使用从UNIX终端输入以下命令:
Use the following command from a UNIX terminal:
docker exec <container_name> pg_dump <schema_name> > backup
以下命令将仅转储所有表中的插入内容:
The following command will dump only inserts from all tables:
docker exec <container_name> pg_dump --column-inserts --data-only <schema_name> > inserts.sql
这篇关于如何从Docker容器生成Postgresql转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文