Skip to content

Instantly share code, notes, and snippets.

@rivetmichael
Last active February 28, 2016 01:00
Show Gist options
  • Save rivetmichael/b4cd2e1918d9fdc72734 to your computer and use it in GitHub Desktop.
Save rivetmichael/b4cd2e1918d9fdc72734 to your computer and use it in GitHub Desktop.
Docker snippet

Backing up data from data container

$ docker run --rm --volumes-from [DATA_CONTAINER_NAME] -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar [/path/to/the/data/to/backup]

Restoring data to data container

$ docker run --rm --volumes-from [DATA_CONTAINER_NAME] -v $(pwd):/backup ubuntu bash -c "cd [/path/to/datadir] && tar xvf /backup/backup.tar --strip 1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment