Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
Named volume not being created in docker

I'm trying to create a django/nginx/gunicorn/postgres docker-compose configuration.

Every time I call docker-compose down, I noticed that my postgres db was getting wiped. I did a little digging, and when I call docker-compose up, my named volume is not being created like i've seen in other tutorials.

What am I doing wrong?

Here is my yml file (if it helps, I'm using macOS to run my project)

version: "3"
volumes:
  postgres:
    driver: local

services:
  database:
    image: "postgres:latest" # use latest postgres 
    container_name: database
    environment:
      - POSTGRES_USER=REDACTED
      - POSTGRES_PASSWORD=REDACTED
      - POSTGRES_DB=REDACTED
    volumes:
      - postgres:/postgres
    ports:
    - 5432:5432


  nginx:
    image: nginx:latest
    container_name: nginx
    ports:
      - "8000:8000"
    volumes:
      - ./src:/src
      - ./config/nginx:/etc/nginx/conf.d
      - ./src/static:/static 
    depends_on:
      - web

  migrate:
    build: .
    container_name: migrate
    depends_on: 
    - database  
    command: bash -c "python manage.py makemigrations && python manage.py migrate"
    volumes:
      - ./src:/src
  web:
    build: .
    container_name: django
    command: gunicorn Project.wsgi:application --bind 0.0.0.0:8000
    depends_on:
      - migrate
      - database

    volumes:
      - ./src:/src
      - ./src/static:/static 
    expose:
      - "8000"

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You should mount the data directory to /var/lib/postgresql/data

 volumes: $ sudo su - postgres $ psql -f /var/lib/postgresql/data
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!