<p>To increase the start up time, you need to &quot;bake&quot; (install) more of what is in your start up script into the image.</p>
<p>Snapshotting is <em>one</em> method, but I would avoid manually creating instances and then taking snapshots.</p>
<p>A better approach is to automate the creation of these images. <a href="https://www.packer.io/" rel="nofollow noreferrer">Hashicorp Packer</a> is the most common tool used for doing this. You can find the GCP &quot;builder&quot; <a href="https://www.packer.io/docs/builders/googlecompute" rel="nofollow noreferrer">here</a></p>
<p>In your case for example, you could install Docker and pull the containers that you want to be running as part of the Packer build.</p>
<p>This build is saved in your GCP account as an image, and your autoscaling group can use this image as its base.</p>
<p>Once the instance comes up, the startup script just applies some basic configuration and tries to start the image which has already been cached.</p>

CC BY-SA 4.0
2021-07-22T15:00:10.793Z
2021-07-22T15:00:10.793Z
Matthew Hodgkins
<p>We're using Google Cloud Platform with an autoscaled pool of VM behind a google's load-balancer.</p>
<p>When a new VM is created in the pool it starts from a template then executes a startup-script. The startup script is pulling multiple docker images and it takes some precious time.</p>
<p>I'd like to reduce this time. From what i saw on the internet some people prefer to boot from a snapshot but this wouldn't work in my case since the snapshot would give the same ip for all my VM.</p>
<p>Do you have any good practice on how to pull these docker images faster or before creating the new VM ?</p>

<docker><autoscaling><gcp>
Accelerate autoscaled VM boot time
Dorf
# Accelerate autoscaled VM boot time

(Asked by: username_0 on 2021-07-22)

We're using Google Cloud Platform with an autoscaled pool of VM behind a google's load-balancer.

When a new VM is created in the pool it starts from a template then executes a startup-script. The startup script is pulling multiple docker images and it takes some precious time.

I'd like to reduce this time. From what i saw on the internet some people prefer to boot from a snapshot but this wouldn't work in my case since the snapshot would give the same ip for all my VM.

Do you have any good practice on how to pull these docker images faster or before creating the new VM ?

**Tags:** docker, autoscaling, gcp


---

## 1 answers

### Answer by username_1 on 2021-07-22. Score: 1

To increase the start up time, you need to "bake" (install) more of what is in your start up script into the image.

Snapshotting is *one* method, but I would avoid manually creating instances and then taking snapshots.

A better approach is to automate the creation of these images. [Hashicorp Packer](https://www.packer.io/) is the most common tool used for doing this. You can find the GCP "builder" [here](https://www.packer.io/docs/builders/googlecompute)

In your case for example, you could install Docker and pull the containers that you want to be running as part of the Packer build.

This build is saved in your GCP account as an image, and your autoscaling group can use this image as its base.

Once the instance comes up, the startup script just applies some basic configuration and tries to start the image which has already been cached.


---

