Installing NVIDIA drivers on a new VM instance can be time consuming, especially if you are creating numerous images. One way to prevent this is to create your own image that is based on one of the Deep Learning VM images, but that already has the NVIDIA drivers preinstalled.
This topic describes how to create a new image based on an existing Deep Learning VM image.
Create a new instance
First, follow the instructions in one of the following topics to create a new instance. Be sure to include at least one GPU in your new instance.
- Creating a TensorFlow Deep Learning VM Instance
- Creating a PyTorch Deep Learning VM Instance
- Creating a Deep Learning VM Instance from the Command Line
- Creating a Deep Learning VM Instance from the Cloud Marketplace
Verify NVIDIA driver install
Once the instance has booted, verify that the NVIDIA driver has been installed:
- SSH to your image:
gcloud compute ssh "DEPLOYMENT_NAME"
- Run the following command:
nvidia-smi
If the drivers have been installed, you can continue.
Stop the instance
Stop the instance by running the following command:
gcloud compute instances stop "DEPLOYMENT_NAME"
Create your own image
Now you create your own image based on the stopped instance. Run the following at the command line, giving the new image a name and a family name:
gcloud compute images create "NEW_IMAGE_NAME" \ --source-disk DEPLOYMENT_NAME \ --source-disk-zone ZONE \ --family NEW_FAMILY_NAME
Once the command is finished running, you have a new image with NVIDIA drivers preinstalled that you can use to create new Deep Learning VM instances.