I am trying to store the data of my container on an 'external hard drive' (/dev/xvdd) that is mounted at /mnt/datadbs.
My docker-compose.yml looks like this:
version: "3":
services:
...
volumes:
prometheus-data:
driver: local
driver_opts:
type: btrfs
device: /mnt/dataebs
When I start the container, I am getting the following error:
ERROR: for prometheus Cannot create container for service prometheus: failed to mount local volume: mount /mnt/dataebs:/var/lib/docker/volumes/ubuntu_prometheus-data/_data: block device required
Can someone point me in the right direction? Eventually, I want to be able to store several docker volumes on the 'external hard drive'.
Try changing your named volume declaration type to "bind" instead of "btrfs".
So it would be something like this:
You can also bind mount directly in your service declaration, so something like this: