0

I'm using Django with Postgres database so I've created separate docker containers for Django and Postgres, now I want to share the dump file with my team but I'm unable to access the dump file, please let me know how can I access the dump file and after accessing it how can we import it using the container?

docker-compose.yml

version: "3.8"
   
services:
  pgdb:
    image: "postgres"
    restart: always
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    ports:
      - "5432:5432"

location inside db docker container

enter image description here

1

1 Answer 1

1

You can access it using docker cp utility

docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-

But rather than doing that you can directly pipe output of pg_dump

docker exec -t container pg_dump ... > dump.sql

and import

cat dump.sql | docker exec -i container psql ...
Sign up to request clarification or add additional context in comments.

1 Comment

how would I import that dump inside the same container on another system?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.