user2080105
user2080105

Reputation: 1686

How to safely configure postgresql data folder with docker?

version: '3'

services:
  db:
    image: postgres
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
  web:
    build: .
    command: python3 manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    depends_on:
      - db

Upvotes: 0

Views: 590

Answers (1)

yamenk
yamenk

Reputation: 51836

The important part of the postgres container, so backing up the data folder is enough. Starting a new container is cheap in your situation, the data is what is important.

The there no obvious reason for why the volume won't work, unless you delete the postgres-data folder accedentaly.

In summary, by inspecting the compose file, things are normal and safe.

Upvotes: 1

Related Questions