If, when doing something like docker-compose up
, you run into an error like this:
ERROR: Named volume "server/db:/usr/share/nginx/html/db:rw" is used in service "web" but no declaration was found in the volumes section.
You're missing a leading ./
, so, for example:
volumes:
- 'server/db:/usr/share/nginx/html/db'
should read
volumes:
- './server/db:/usr/share/nginx/html/db'
This example assumes that you want to map a host directory ./server/db/
to a container directory /usr/share/nginx/html/db
, not create a named volume server/db
.
Yes, to clarify, that was my intent (i.e. I wanted to map the local directory
./server/db
to/usr/share/nginx/html/db
in the container, not a named volumeserver/db
)