Quick Start and Basic Operation
DGX A100 System
DU-09821-001_v06
| 27
4.7.2
Using the NVIDIA Container Runtime for
Docker
Note
: The NVIDIA Container Runtime for Docker is deprecated and will be removed from the DGX
OS in a future release.
Currently, the DGX OS also includes the NVIDIA Container Runtime for Docker (nvidia-
docker2) which lets you run GPU-accelerated containers in one of the following ways.
Use docker run and specify runtime=nvidia.
$ docker run --runtime=nvidia ...
Use nvidia-docker run.
$ nvidia-docker run ...
The nvidia-docker2 package provides backward compatibility with the previous nvidia-
docker package, so you can run GPU-accelerated containers using this command and the
new runtime will be used.
Use docker run with nvidia as the default runtime.
You can set nvidia as the default runtime, for example, by adding the following line to the /
etc/docker/daemon.json configuration file as the first entry.
"default-runtime": "nvidia",
The following is an example of how the added line appears in the JSON file. Do not remove any
pre-existing content when making this change.
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
You can then use docker run to run GPU-accelerated containers.
$ docker run ...
!
CAUTION
: If you build Docker images while nvidia is set as the default runtime, make
sure the build scripts executed by the Dockerfile specify the GPU architectures that the
container will need. Failure to do so may result in the container being optimized only for
the GPU architecture on which it was built.
Instructions for specifying the GPU architecture depend on the application and are beyond the
scope of this document. Consult the specific application build process.