Docker volumes live in a directory managed by Docker, so there is no obvious file to copy. The docs show a way around that.
Start a temporary container that mounts the volume and a host folder, and let it write a tar archive.
docker run --rm \
--volumes-from mycontainer \
-v "$(pwd)":/backup \
ubuntu tar cvf /backup/backup.tar /data
Here /data is the path where mycontainer mounts the volume. --volumes-from gives the helper the same mounts, and the current directory shows up as /backup. The --rm removes only the helper, not your volume. To restore, you do it the other way round and extract the archive into the target volume.
If the volume is a named one, you can mount it directly in the helper with -v myvolume:/data instead of using --volumes-from. Same result, and you do not need the original container to exist at all.
The caveat is consistency. A database that is writing while you tar its files can give you a broken backup. Stop the container first, or use the database’s own dump tool. I would also test one restore before I trust any of this.
Further reading: Volumes: back up, restore, or migrate data volumes, On this site: browse and upload files inside a Docker volume from Portainer, On this site: run docker system df before you prune anything, On this site: Guide: back up and restore a Docker volume with one throwaway container