Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 3.09 KB

INSTALLING_NVIDIA_CONTAINER_RUNTIME.md

File metadata and controls

34 lines (22 loc) · 3.09 KB

Installing Nvidia Container Runtime

If your host machine has an Nvidia GPU and you want to use it for hardware graphics acceleration inside your container, you will have to install Nvidia container runtime on the host.

We will not cover all the installation steps in this documentation, because Nvidia provides an extensive official guide on the subject matter, so please follow it to install the software. However, here are some tips which may be useful during the installation process:

  • Before you can install the runtime, install Docker and Nvidia driver on your host machine.

  • If you have Docker Desktop installed on the host, your Nvidia container runtime installation may not work after completing the guide, complaining that runtime cannot be found. This happens because Docker Desktop overrides Docker’s default configuration file (daemon.json), and that file is not updated automatically during the installation. To make Docker see the new Nvidia runtime, you have to add this runtime in Docker Desktop’s settings (highlighted text): screenshot of Docker Desktop with the configuration file editing window open

    ℹ️ To access the menu displayed above, in Docker Desktop open Settings (cog icon in the top right corner) and select Docker Engine in the left sidebar menu.

    After the file is modified, click "Apply & Restart" and wait for Docker Engine to restart itself. After that, Nvidia runtime will become available to the containers.

  • To confirm that the installation was successful, run the following command in your host machine's terminal:

    docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi --list-gpus

    ℹ️ The command above launches a test Nvidia Docker container and lists the GPUs available inside it.

    If you did everything right, you will see your GPU in the list of devices output by this command. Otherwise, the command will fail saying that the executable was not found - in this case, go through the installation guide again and check if you missed anything.