Search code examples
dockerbackupibm-cloudvolume

How can I backup volumes in the IBM Docker Cloud in Bluemix?


I know how to save docker images when I can access them locally, but how can I backup a volume container in the IBM Bluemix platform?

Thanks Ansi


Solution

  • the simplest way to backup a (remote) container's volume is to mount the volume on another volume and tar it: once the tar is completed you could download it using scp/sftp/ftp/http or the service you prefer to connect to the container (also according to the services available on it).

    To mount the volume on another container you could use --volumes-from flag to create a new container mounting this volume:

    docker run --volumes-from [source container] -v /volume_backup ubuntu tar cvf /volume_backup/backup.tar /path_to_backup
    

    This command launches a new container and mounts the volume from the [source container] container using the same path /path_to_backup. Then here a new volume is created and mount on /backup path.

    Finally a tar is launched to tar the content of /path_to_backup volume to a backup.tar file inside the /backup directory.

    When the command finishes, even if the container has been stopped, the backup is contained in the other volume: you could mount this volume in another container to download it, or to push/pull/upload or to whatever you want.

    This backup could also be simply restored exploding the tar in the /path_to_backup path of the first container.

    Otherwise you could use this ready container useful for backup: https://github.com/docker-infra/docker-backup

    Here you can find docker docs to manage docker volumes: the only difference is that you should think about a way to move/copy the backup on your local environment or wherever you wish to keep your volumes backups

    http://docs.docker.com/v1.8/userguide/dockervolumes/