Bind mount vs docker volume

The quick installation guide from https://hub.docker.com/r/vaultwarden/server suggest using a bind mount to map a local file system folder to the container’s /data folder.

I am wondering what could be the reason not to use that but a docker volume instead, and why is the bind mount apparently preferred over the alternative.

Thanks,

Bind mounts store the data in a for you easily accessible folder on the host.
Volumes are still stored on the host of course but are abstracted away from your view.

Creating backups or running commands like docker system prune -a --volume could delete that data. While storing it in a directory on the host will not.

Also, some tools like Portainer sometimes make a mess of the volumes and could cause confusion for users.

1 Like

Thanks. I am really failing in seeing the advantages of the other approach, despite it being recommended in the official Docker documentation.

In particular, quoting from that site

Bind mounts have limited functionality compared to volumes” and “If you are developing new Docker applications, consider using named volumes instead.”

But I fail to see how that functionality would be limited by using a bind mount in this use case.

Use whatever you want to use and prefer your self.
It will not impact Vaultwarden at all.

1 Like