secondbreakfast
secondbreakfast

Reputation: 4384

Where is the backup.tar file being saved in this example?

From the docker documentation: https://docs.docker.com/storage/volumes/

Backup a container

For example, in the next command, we:

  • Launch a new container and mount the volume from the dbstore container
  • Mount a local host directory as /backup
  • Pass a command that tars the contents of the dbdata volume to a backup.tar file inside our /backup directory.
$ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata

When the command completes and the container stops, we are left with a backup of our dbdata volume.

I ran this command replacing the example names with the ones of my actual project, but yet a backup.tar is nowhere to be seen. When I run through the command it prints out the contents of the volume im backing up so I know its finding the right one and everything but I see no backup file. Is this supposed to end up on the host machine? on the container being backed up? in the temporary container used to create the backup? im confused.

Upvotes: 1

Views: 81

Answers (1)

trpl
trpl

Reputation: 31

It is supposed to be in the folder specified by $(pwd) on your host machine.

If you want to specify another folder, just put the location you want in there.

Upvotes: 1

Related Questions