Go to documentation repository
Forwarding the GPU provides the container with access to the server GPU (host), on which Docker is installed and containers run. Only the NVIDIA GPU forwarding is supported, and the container uses the drivers installed on the host.
To forward the GPU, do the following:
nvidia-smi
sudo systemctl restart docker
sudo docker run --gpus all <image_id>/<container_id>
sudo docker inspect <container_id> | grep"IPAddress"
Note
You can add the GPU support to the already created container. To do this, do the following:
apt update && apt install -y \
cuda-toolkit-12-1 \
libcudnn8
sudo docker exec -it <container_id> sh
nvidia-smi
Forwarding the GPU in the Docker container is complete.