Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: using Using --volumes-from to backup data files

having some issues with this and need a little help (guidance). The data I want to backup is located here: /var/lib/docker/volumes/eb5294b586d6537c965bde61d02da06d49ff77467afdc55ec1441413fe5fb128/_data

so I need to create a backup of this volume data and transfer it to another host. From this website https://docs.docker.com/engine/tutorials/dockervolumes/#creating-and-mounting-a-data-volume-container it says to use the following command: $ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata

What is the "ubuntu" for? I am running on Ubuntu but in the explanation of the command, it doesn't say anything about it. Is it something that is optional? What about the /backup directory, where is that created? In the Home directory of the logged in user?

Thanks, Don

like image 339
Don Mangiarelli Avatar asked Nov 19 '25 01:11

Don Mangiarelli


1 Answers

What is the "ubuntu" for?

It's the base image that contains the tar utility.

I am running on Ubuntu but in the explanation of the command, it doesn't say anything about it. Is it something that is optional?

You need any docker image, which must have the tar command. It is not optional, you must provide the base image that a container will run on. (In your case you are running a one-off container: tar)

What about the /backup directory, where is that created? In the Home directory of the logged in user?

That is a mapped volume:

-v $(pwd):/backup

$(pwd) is your current working directory (which you run the docker command), mapped to the /backup/ dir in the container, where the tar command is instructed to deposit your backup file (backup.tar). So that file will appear where you run the docker command.

like image 163
Robert Avatar answered Nov 20 '25 15:11

Robert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!