Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

246
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda