Examples of Running Containers

Logging Into the NGC Container Registry

You need to log in to the NGC container registry only if you want to access locked containers from the registry. Most of the NGC containers are freely available (unlocked) and do not require an NGC account or NGC API key.

If necessary, log in to the NGC container registry manually by running the following script from the VMI.

ngc-login.sh <your-NGC-API-key>

From this point you can run Docker commands and access locked NGC containers from the VM instance.

Example: MNIST Training Run Using PyTorch Container

Once logged in to the Amazon EC2 P3 instance, you can run the MNIST example under PyTorch.

Note that the PyTorch example will download the MNIST dataset from the web.

Pull and run the PyTorch container:

docker pull nvcr.io/nvidia/pytorch:18.02-py3
docker run --runtime=nvidia --rm -it nvcr.io/nvidia/pytorch:18.02-py3

Run the MNIST example:

cd /opt/pytorch/examples/mnist
python main.py

Example: MNIST Training Run Using TensorFlow Container

Once logged in to the Amazon EC2 P3 instance, you can run the MNIST example under TensorFlow.

Note that the TensorFlow built-in example will pull the MNIST dataset from the web.

Pull and run the TensorFlow container:

docker pull nvcr.io/nvidia/tensorflow:18.02-py3
docker run --runtime=nvidia --rm -it nvcr.io/nvidia/tensorflow:18.02-py3

Following this tutorial: https://www.tensorflow.org/get_started/mnist/beginners

Run the MNIST_with_summaries example:

cd /opt/tensorflow/tensorflow/examples/tutorials/mnist
python mnist_with_summaries.py