In the command line I am used to run/create containers with specific GPUs using the --gpus argument:
docker run -it --gpus '"device=0,2"' ubuntu nvidia-smi
The Docker SDK for Python documentation was not very helpful and I could not find a good explanation on how to do the same with the python SDK. Is there a way to do it?
This is how you can run/create docker containers with specific GPUs using the Docker SDK for Python:
This way you can also use other GPU resource options specified here: https://docs.docker.com/config/containers/resource_constraints/