Postgres dump data in container

    0

    0

    Neuron123

    This command will dump all of the data in the postgres database to a file named dump_2018-06-15_13-41-24.sql .

    The -t flag tells Docker to run the command in a terminal. The <your-postgres-container-id> refers to the ID of the container that you created to run PostgreSQL. The -c flag tells PostgreSQL to dump the data instead of working with it. The -U flag tells PostgreSQL to use the user postgres instead of the default user root . The > dump_date +%d-%m-%Y"_"%H_%M_%S.sql tells Docker to append the output of the command to the filename dump_2018-06-15_13-41-24.sql .

    docker exec -t <your-postgres-container-id> pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.