Running NVIDIA Optimized Deep Learning Framework, powered by Apache MXNet

Before you begin

Before you can run an NGC deep learning framework container, your Docker® environment must support NVIDIA GPUs. To run a container, issue the appropriate command as explained in Running A Container and specify the registry, repository, and tags.

About this task

On a system with GPU support for NGC containers, when you run a container, the following occurs:
  • The Docker engine loads the image into a container which runs the software.
  • You define the runtime resources of the container by including additional flags and settings that are used with the command.

    These flags and settings are described in Running A Container.

  • The GPUs are explicitly defined for the Docker container, which defaults to all GPUs, but can be specified by using the NVIDIA_VISIBLE_DEVICES environment variable.

    For more information, refer to the nvidia-docker documentation.

    Note: Starting in Docker 19.03, complete the steps below.

The method implemented in your system depends on the DGX OS version that you installed (for DGX systems), the NGC Cloud Image that was provided by a Cloud Service Provider, or the software that you installed to prepare to run NGC containers on TITAN PCs, Quadro PCs, or NVIDIA Virtual GPUs (vGPUs).


  1. Issue the command for the applicable release of the container that you want.

    The following command assumes you want to pull the latest container.

    docker pull
  2. Open a command prompt and paste the pull command.

    Ensure that the pull process successfully completes before you proceed to step 3.

  3. Run the container image.
    • If you have Docker 19.03 or later, a typical command to launch the container is:
      docker run --gpus all -it --rm -v local_dir:container_dir<xx.xx>-py3
    • If you have Docker 19.02 or earlier, a typical command to launch the container is:
      nvidia-docker run -it --rm -v local_dir:container_dir<xx.xx>-py3
    To run the NVIDIA Optimized Deep Learning Framework, powered by Apache MXNet, import it as a Python module:
    $ python
    	Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
    	[GCC 5.4.0 20160609] on linux
    	Type "help", "copyright", "credits" or "license" for more information.
    	>>> import mxnet as mx
    	>>> a = mx.nd.ones((2,3), mx.gpu())
    	>>> print((a*2).asnumpy())
    	[[ 2.  2.  2.]
    	 [ 2.  2.  2.]]

    To pull data and model descriptions from locations outside the container for use by the Optimized Deep Learning Framework or save results to locations outside the container, mount one or more host directories as Docker data volumes.

    Note: To share data between ranks, NVIDIA Collective Communications Library (NCCL) might require shared system memory for IPC and pinned (page-locked) system memory resources, so you might need to increase your operating system’s limits on these resources. Refer to your system’s documentation for more information.
    In particular, Docker containers default to limited shared and pinned memory resources. When using NCCL in a container, we recommend that you increase these resources by issuing the following command:
    --shm-size=1g --ulimit memlock=-1
    in the command line to:
    docker run --gpus all