Looking at the docs for the GCE driver for Docker Machine, it seems that it's not possible to spawn a machine that has a GPU attached. In contrast to AWS, where there are specific machine types that come with a GPU, and thus are supported by Docker Machine, in GCP you have to add switches to spin up a VM with a GPU.

Anyone knows a way to tell Docker Machine to provision a VM with a GPU in Google Compute Engine?

  • I know that with AWS you can have an instance with a GPU but I wasn't aware that a docker container, on a VM or any other way, could deal with a GPU - is this definitely the case? If so I've learned something new today! – Chopper3 Sep 27 '18 at 14:28
  • 1
    @Chopper3 You need a pretty recent version of Docker, but yes, you can now assign a GPU to a container. – Michael Hampton Sep 27 '18 at 18:34
  • Yes, it's possible thanks to the Nvidia Docker runtime, and it works great. – Thomas Wana Sep 28 '18 at 12:44
  • @ThomasWana did you figure out how to attach the GPU with docker-machine, though? – Dav Clark Feb 19 '19 at 22:37
  • Yes, but it's still not officially supported in docker-machine. I'm using docker-machine from a pull request that supports the required additional flags: github.com/docker/machine/pull/4504 – Thomas Wana Feb 20 '19 at 10:11

There's no way to run a GCE VM instance with GPU and make a host for container that would have access to that GPU.

It is possible however to do this using Kubernetes Engine so the containers (nodes) will have access to the hosts' GPU.

There are some limitations to that:

  • You cannot add GPUs to existing node pools.
  • GPU nodes cannot be live migrated during maintenance events.
  • GPUs are only supported with general-purpose N1 machine types.

Also - run this gcloud command to verify the list of GPU's available in your zone: gcloud compute accelerator-types list

If everything checks out than you're ready to set up your K8S cluster with GPU's.

Another such question was also discussed here in this theread which you may find helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.