Max Voitko
Max Voitko

Reputation: 1629

Using GPU with containers and Container Optimized OS in Google Cloud VM

I would like to run a custom Docker image with GPU on Google Compute Engine. I have built and pushed the image to the Google Container Registry. It seems logical to use Container-Optimized OS for a host machine in Google Cloud Engine since I don't need any extra soft on the host machine except Docker, Nvidia GPU drivers and nvidia-container-runtime.

I managed to install nvidia-drivers with this solution.

But I can't run my Docker image with GPU (using --gpu all option) without nvidia-container runtime. This step is specified in official Docker documentation.

Is there a way to install nvidia-container-runtime on Container-Optimized OS in Google Cloud VM?

Upvotes: 6

Views: 1903

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76569

You don't have to set --gpu all, because this is the default option for nvidia-container-runtime. The assumption, that you don't need anything else is wrong, because it requires libnvidia-container.

To precisely answer the question: No, because libnvidia-container needs to be installed on the OS and nvidia-container-runtime needs to be installed within the K8s container. The one exposes an interface - and the other connects it. And so the one is useless without the other.

Upvotes: 3

Related Questions