S
S
Sergey Alekseev2019-12-31 07:07:44
bash
Sergey Alekseev, 2019-12-31 07:07:44

Bash-script, how to properly recreate a container and fill it with a dump?

There is a script that should upload the dump to the docker container, in which the postgres. But it turns out like this: A dump is created, the container is recreated and that's it

#!/bin/bash

DANLK_USER=1
DANLK_DB=1
DANLK_LOGBOOK_DB=1
DANLK_TEST_DB=1
DANLK_PASSWORD=1

pg_dump --dbname=postgresql://$DANLK_USER:[email protected]:5432/$DANLK_DB > danlk_test.sql

docker-compose down
docker-compose up

docker-compose exec -T postgres psql -U $DANLK_USER $DANLK_LOGBOOK_DB < danlk_logbook.sql
docker-compose exec -T postgres psql -U $DANLK_USER $DANLK_TEST_DB < danlk_test.sql

rm danlk_test.sql

What is the problem here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question