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

1.3K
Vistas
ERROR: Named volume "mongodb:/data/db:rw" is used in service "mongo" but no declaration was found in the volumes section

I just start learning Docker recently. Trying to set up a service that stores database.

Here's my docker-compose.yml:

version: "3.7"

services:
  mongo:
    image: mongo
    ports:
    - 27018:27017
    volumes:
    - mongodb:/data/db

volumes:
  mongo:

As I run docker-compose up ., I got this error:

ERROR: Named volume "mongodb:/data/db:rw" is used in service "mongo" but no declaration was found in the volumes section.

And I did create my named volume mongodb outside. Running docker volume ls would give me:

DRIVER    VOLUME NAME
local     mongodb

Any ideas? Thanks alot.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

For named volumes you should have a "volumes" key on a same level as "services", and any named volumes you are using in your services have to be listed under the "volumes" key (where you missed).

in your case :

version: "3.7"

services:
  mongo:
    image: mongo
    ports:
    - 27018:27017
    volumes:
    - mongodb:/data/db

volumes:
  mongodb:

Just a reminder : anonymous volumes, and bind mounts don't need to be specified here.

hope this helped you :)

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