nvidia docker install
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker
Installation Guide
Supported Platforms
The NVIDIA Container Toolkit is available on a variety of Linux distributions and supports different container engines.
Linux Distributions
Supported Linux distributions are listed below:
OS Name / Version |
Identifier |
amd64 / x86_64 |
ppc64le |
arm64 / aarch64 |
---|---|---|---|---|
Amazon Linux 1 |
amzn1 |
X |
||
Amazon Linux 2 |
amzn2 |
X |
||
Amazon Linux 2017.09 |
amzn2017.09 |
X |
||
Amazon Linux 2018.03 |
amzn2018.03 |
X |
||
Open Suse Leap 15.0 |
sles15.0 |
X |
||
Open Suse Leap 15.1 |
sles15.1 |
X |
||
Debian Linux 9 |
debian9 |
X |
||
Debian Linux 10 |
debian10 |
X |
||
Centos 7 |
centos7 |
X |
X |
|
Centos 8 |
centos8 |
X |
X |
X |
RHEL 7.4 |
rhel7.4 |
X |
X |
|
RHEL 7.5 |
rhel7.5 |
X |
X |
|
RHEL 7.6 |
rhel7.6 |
X |
X |
|
RHEL 7.7 |
rhel7.7 |
X |
X |
|
RHEL 8.0 |
rhel8.0 |
X |
X |
X |
RHEL 8.1 |
rhel8.1 |
X |
X |
X |
RHEL 8.2 |
rhel8.2 |
X |
X |
X |
Ubuntu 16.04 |
ubuntu16.04 |
X |
X |
|
Ubuntu 18.04 |
ubuntu18.04 |
X |
X |
X |
Ubuntu 20.04 |
ubuntu20.04 |
X |
X |
X |
Container Runtimes
Supported container runtimes are listed below:
OS Name / Version |
amd64 / x86_64 |
ppc64le |
arm64 / aarch64 |
---|---|---|---|
Docker 18.09 |
X |
X |
X |
Docker 19.03 |
X |
X |
X |
RHEL/CentOS 8 podman |
X |
||
CentOS 8 Docker |
X |
||
RHEL/CentOS 7 Docker |
X |
Note
On Red Hat Enterprise Linux (RHEL) 8, Docker is no longer a supported container runtime. See Building, Running and Managing Containers for more information on the container tools available on the distribution.
Pre-Requisites
NVIDIA Drivers
Before you get started, make sure you have installed the NVIDIA driver for your Linux distribution. The recommended way to install drivers is to use the package manager for your distribution but other installer mechanisms are also available (e.g. by downloading .run
installers from NVIDIA Driver Downloads).
For instructions on using your package manager to install drivers from the official CUDA network repository, follow the steps in this guide.
Platform Requirements
The list of prerequisites for running NVIDIA Container Toolkit is described below:
-
GNU/Linux x86_64 with kernel version > 3.10
-
Docker >= 19.03 (recommended, but some distributions may include older versions of Docker. The minimum supported version is 1.12)
-
NVIDIA GPU with Architecture > Fermi (or compute capability 2.1)
-
NVIDIA drivers ~= 361.93 (untested on older versions)
Note
Your driver version might limit your CUDA capabilities. Newer NVIDIA drivers are backwards-compatible with CUDA Toolkit versions, but each new version of CUDA requires a minimum driver version. Running a CUDA container requires a machine with at least one CUDA-capable GPU and a driver compatible with the CUDA toolkit version you are using. The machine running the CUDA container only requires the NVIDIA driver, the CUDA toolkit doesn’t have to be installed. The CUDA release notes includes a table of the minimum driver and CUDA Toolkit versions.
Docker
Getting Started
For installing Docker CE, follow the official instructions for your supported Linux distribution. For convenience, the documentation below includes instructions on installing Docker for various Linux distributions.
Warning
If you are migrating fron nvidia-docker
1.0, then follow the instructions in the Migration from nvidia-docker 1.0 guide.
Installing on Ubuntu and Debian
The following steps can be used to setup NVIDIA Container Toolkit on Ubuntu LTS - 16.04, 18.04, 20.4 and Debian - Stretch, Buster distributions.
Setting up Docker
Docker-CE on Ubuntu can be setup using Docker’s official convenience script:
See also
Follow the official instructions for more details and post-install actions.
Setting up NVIDIA Container Toolkit
Setup the stable
repository and the GPG key:
Note
To get access to experimental
features such as CUDA on WSL or the new MIG capability on A100, you may want to add the experimental
branch to the repository listing:
Install the nvidia-docker2
package (and dependencies) after updating the package listing:
Restart the Docker daemon to complete the installation after setting the default runtime:
At this point, a working setup can be tested by running a base CUDA container:
This should result in a console output shown below:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.51.06 Driver Version: 450.51.06 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 34C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
254 curl https://get.docker.com | sh && sudo systemctl --now enable docker
255 distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
257 sudo apt-get install -y nvidia-docker2
258 sudo systemctl restart docker
259 sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi