Home > Enterprise >  Create a GPU enabled container in Dockerfile
Create a GPU enabled container in Dockerfile

Time:01-27

I'm new to docker and I am trying to run tensorflow within a GPU enabled docker container. I have successfully followed this guide: https://www.tensorflow.org/install/docker. I understand that when I want to run a gpu enabled container i have to add the --gpus all argument to the run command like so: run --gpus all tensorflow/tensorflow:latest-gpu. I'm wondering however if there is a way I can create a Dockerfile that builds an image that already has gpu support enabled and the --gpus all argument can be omitted from the run command. Or can I pass this as an argument to docker build rather than docker run

CodePudding user response:

I found the answer to this for my specific use case. I was trying to set up a Docker container to work with VS Code. However VS code has the concept of "dev containers". To create/use a dev container you must create a devcontainer.json file. In it you can specify runargs and add the key: value of

"runArgs": ["--gpus","all"]
  • Related