I’m trying to install Linkwarden and I want to make sure I get the storage right so that if I have to move the data to another VM, it is easy to do. If I use the default compose file, will it simply create a ./data ./pgdata
and ./meili_data
folders in the same folder where the docker compose file is? Which of course is very handy as then I have the compose, the .env and the data all in one place. Is this a good way of managing docker volumes? The install docs here say that I can also set a STORAGE_FOLDER
variable in the .env
file which by default is /data
. But does this mean that the default is in the root directory of the host?
Unrelated: I recommend vaultwarden, an open source community fork in rust. Works great with official bitwarden apps and extensions.
Docker compose files (and docker execs) use the following format
volumes: - <host_storage_path>:<vm_mount_path>
If the docker-compose has a
${VAR_NAME}:/data
, then it will replace it directly with the variable defined in the .env file in the same directory with the formatVAR_NAME=/path/on/host
And would mount the host’s
/path/on/host
to/data
I’ve never used Linkwarden, but the
/data
folder is often used by Docker containers to store the application’s data, so it’s likely an internal path. You’ll have to create a volume that exposes the internal/data
path to the host filesystem, then whatever is written into that directory will be made available to both the container and the host system. Any file or directory in the container can be exposed this way.I usually put my data volumes in
/srv
(where my large RAID array is mounted) and config volumes in/config
, into a subdirectory named after the service, and with the minimal necessary privileges to run the container and the service. You could, for example, create volumes like this:/srv/linkwarden/postgres_data:/var/lib/postgresql/data /srv/linkwarden/linkwarden_data:/data/data /srv/linkwarden/meili_data:/meili_data
The volume path (left side of the colon) can be anything. The right side is where the services expect their files to appear inside the container.