How to generate a Postgresql Dump from a Docker container?

前端 未结 5 602
忘掉有多难
忘掉有多难 2021-01-31 02:55

I would like to have a way to enter into the Postgresql container and get a data dump from it.

5条回答
  •  后悔当初
    2021-01-31 03:27

    To run the container that has the Postgres user and password, you need to have preconfigured variables as container environment variable. For example:

    docker run -it --rm --link : -e POSTGRES_PASSWORD= postgres /usr/bin/pg_dump -h -d -U > dump.sql

提交回复
热议问题