Q:

How does one easily install Nvidia drivers for Google's container-optimized OS?

I'm trying to use Google Compute to play around with some deep learning models. I was hoping to use Nvidia's CUDA container to run these models. A relatively inexpensive way was to utilize Google's container-optimized OS to host the container on.
When I go to the driver, the Nvidia drivers are not installed. As it is a proprietary operating system, I cannot seem to find a way to install any driver for any of the GPUs that Google provides.
The closest thing I found was: https://github.com/ContainerEngine/accelerators/tree/master/cos-nvidia-gpu-installer, but this means creating a new container rather than using Nvidia's which comes with some GPU-accelerated libraries.

A:

This is probably what you want:
https://github.com/GoogleCloudPlatform/cos-gpu-installer#how-to-use
You can try running this command and see if it works for your use case:
gcloud compute instances create $USER-cos-gpu-test \
--image-family cos-stable \
--image-project cos-cloud \
--accelerator=type=nvidia-tesla-k80 \
--boot-disk-size=25GB \
--maintenance-policy=TERMINATE \
--metadata-from-file "cos-gpu-installer-env=scripts/gpu-installer-env,user-data=install-test-gpu.cfg,run-installer-script=scripts/run_installer.sh,run-cuda-test-script=scripts/run_cuda_test.sh"

