0

I deployed a Docker image on a Google Compute Engine virtual machine instance (see containers on compute engine). I would like to perform regular, automatic backups of this instance and it's disks.

Container-Optimized OS has limitations that do not allow to implement solutions like google-compute-snapshot which require to install system packages.

Any recommendations on how should I automate this task?

runixo
  • 156
  • 3
  • 13

2 Answers2

0

You can take the snapshot of any persistent disk attached to a GCP instance(It doesn't matter whether your VM is having a container-optimized OS or not).

In order to perform automation for a snapshot, you can make use of 'gcloud command for snapshot' with the help of a shell script. This script can then run automatically with the help of a cron job, which will ultimately produce automation(check this link for more details) of the snapshots backups.

Additionally, there is this ongoing 'Feature Request' for automated snapshot management in the Google Cloud Platform. You can suggest your valuable comments there as well.

Digil
  • 742
  • 4
  • 12
0

Make sure your container related data are being stored on a persistent disk. Then Install the Google Cloud SDK so as to get gcloud compute commands on your local machine. Or use the readily available Google Cloud Shell .

Then take snapshot of your persistent disk. To ensure that a snapshot is consistent with the desired state of the persistent disk, it is best practice to pause it. Though you can create a snapshot of a persistent disk even while your applications write data to the disk.

Use:

$ gcloud compute disks snapshot [DISK_NAME]

This the only command you need to run to have a screenshot of your root or data volume.

Lena Weber
  • 272
  • 2
  • 4
  • With 'container related data', are you sure you can store the container metadata in the disk? (for example, the docker image name used by the Container Optimized OS) – runixo Mar 16 '18 at 14:08