Unable to take backups

Hello, I’m a little new here, so I apologize if I’m misunderstanding anything
I’m on Windows 10 using Desktop Docker
I was able to find the files of the databases where you’d take copies, please tell me if this is wrong but here’s the full path:
\wsl$\docker-desktop\tmp\docker-desktop-root\mnt\version-pack\containers\services\docker\rootfs\vw-data
When I try to copy the files from there and put it onto my desktop, it says “you require permission from the computer’s administrator to make changes to this file”
Is there anyway to fix this, or am I in the wrong directory?

Update: Got it working! It’s actually a different location, it’s
\wsl$\docker-desktop\tmp\docker-desktop-root\mnt\version-pack\containers\services\docker\tmp\upper\vw-data

Weird that they have everything the same within them but one I can access through copying the files and one has no permission

I don’t personally run docker on Windows or have extensive knowledge on WSL and the file tree there, I would imagine

is going to only be a tmp directory and not meant to be a full path, but system files for docker to use while running under WSL.

Ultimately you should have a variable in your docker command (or docker-compose file) which will tell docker to mount a path on your host system Windows to pass into the docker container

    -v C:\vaultwarden\vw-data:/data/

It appears this can be done through docker desktop via the application GUI by adding a “file share” between the Windows host and the linux container running vaultwarden.
With the note:

Use File sharing to allow local directories on Windows to be shared with Linux containers. This is especially useful for editing source code in an IDE on the host while running and testing the code in a container. Note that configuring file sharing is not necessary for Windows containers, only Linux containers. If a directory is not shared with a Linux container you may get file not found or cannot start service errors at runtime. See Volume mounting requires shared folders for Linux containers.

Hopefully once a file share it set up between the host and container you will be able to access those files, you may also still need to provide admin permissions to change file ownership as I’m not sure how this will translate from inside the container being owned by root to outside the container in a Windows system with a user account.
Also depending on your database method, backups will also require some type of application aware backup to properly close any tables in the database and prevent corruption. If using the default sqlite database you will want have sqlite3 installed on your host to make backups.

Unfortunately, there appears to be no setting anywhere within the Docker program that relates to file sharing, as well, I don’t have any docker-compose file or run any commands to actually start the containers, it’s all graphical-based (I just press start or during initial install it was setup to automatically start/restart)

Would you be able to provide some basic info about the command used to start the container with cmd after docker desktop and WSL2 was installed on the Windows system?

When I run the basic run command

docker run -d --name vaultwarden -v /vw-data/:/data/ -p 80:80 vaultwarden/server:latest

the file location you describe does indeed show up

\\wsl$\docker-desktop\tmp\docker-desktop-root\mnt\version-pack\containers\services\docker\rootfs\vw-data\
which contains the db.sqlite3 files and other requires files, but as mentioned this file path is located in a /tmp/ directory on the host and I believe is used as the directory for which docker uses to run the the container system using namespaces and the shared WSL2 on the Windows host.
This Tmp directory is as intended temporary and as far as I can tell will be rebuilt when docker service is restarted, server restart, or the docker container is stopped.

PLEASE NOTE

Do not run any commands prior to backing up your vault data in the web GUI, typically unencrypted if needing to import into a new vault.
Also note these will be under the assumption of a new system, if you do not currently know or have a mount point set you may lose data when the container is reset, unless the container parameters can be changed without unmounting data.

There does also appear to be a way to create container volumes within the docker desktop application


Once the volume is created, a similar command can run the container and mount the volume

docker run -d --name vaultwarden -v ./vw-data/:/data/ -p 80:80 vaultwarden/server:latest

Notate the dot prior to /vw-data for the host mount point

./vw-data/:/data/

This appears to run the container with the newly created volume




Hopefully some of this information helps to assist you in locating your data on the host Windows system.
Ideally you would be able to have data mounted easily to the host, and my personal preference is to use docker-compose as it doesn’t take much to understand and can help to manage multiple containers, as well as several variables if needing to set multiple things such as a volume, port, restart policy, and other environment variables.

Cheers :slight_smile:

Thanks so much for all of the information! I intend on removing all of my currently existing containers/images/volumes and moving them over to the actual spots I want them in, and not in WSL later today!
Thankfully, the stuff I have on this system is mostly just for testing and not long-term yet until I can figure out some things