docker run \
--volumes-from dbdata \
-v $(pwd):/backup \
ubuntu \
tar cvf /backup/backup.tar /dbdata
Here we’ve launched a new container and mounted the volume from the dbdata container.
We’ve then mounted a local host directory as /backup.
Finally, we’ve passed a command that uses tar to backup the contents of the dbdata volume to a backup.tar file inside our /backup directory.
When the command completes and the container stops we’ll be left with a backup of our dbdata volume.
https://stackoverflow.com/questions/34357252/docker-data-volume-vs-mounted-host-directory
docker inspect <CONTAINER_ID> | jq .[] | jq .Mounts[]