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.