6

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the explanation! I mentioned that I am interested in Google COmpute Enginer instance, not k8s cluster.
Does it mean that it's impossible to run containers with GPU on Google Compute instance?
If you wish to access the GPU from within Docker, you need to install both components... and you cannot run the run-time directly on GCE. It's GPU <-> kernel module (driver) <-> libnvidia-container <-> nvidia-container-runtime. It's complicated, but this is based upon several abstraction layers. And I don't think that there would be much difference, in between Container Engine & Compute Engine.
And that --gpu switch is merely to use different GPU with different Docker containers.
my question was not about --gpu switch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.