Last few days,I need a docker coinainer with Nvidia GPU cards.Nvidia released a special docker version with usage for Nvidia GPU cards.And Nvidia has a driver what name is CUDA driver.You can use GPU cards on running container using this driver.
You can examine and install below github adress.
https://github.com/NVIDIA/nvidia-docker
To begin with,I start the control of my GPU cards.
nvidia-smi
Later,I create a variable on my profile file for docker usage.
export DOCKER_BINARY=nvidia-docker
Then,I create a docker container with below command.
NV_GPU=1 $DOCKER_BINARY run -p 5555:22 -dti --env LICENSE=yes baseimage
#I use second GPU card.When I want to use 2 gpu cards,I will use below command
NV_GPU=0,1 $DOCKER_BINARY ...
Check with docker ps command.
ssh -p 5555 emre@1.1.1.1