Image import to Compute Engine instance fails

Problem

When trying to import an image to Google Compute Engine, the import fails and you see the following error:

Import did not complete within the specified timeout of 1h56m24s

ERROR

ERROR: build step 0 "gcr.io/compute-image-tools/gce_vm_image_import:release" failed: step exited with non-zero status: 1

ERROR: (gcloud.compute.images.import) build xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx completed with status "FAILURE"

Environment

  • Cloud SDK

Solution

Run the same command again setting the --timeout=TIMEOUT  flag to a value more than 2 hours. For example:

gcloud compute images import myimage-name --os=centos-7 --source-file=mysourcefile --timeout=4h

Cause

If the timeout value is not set, the default is 2 hours. If the image being imported is large, then the operation might not complete successfully within the 2 hours default timeout period.