Step #1: Setting Up Docker
Before starting, Docker needs to be installed on a local workstation where containers can be pulled, run, modified, and pushed to NGC. This assumes you are running a modern Linux-based Operating System on your workstation with external internet access and a user with either root or sudo privileges. The following commands are shown using sudo rather than root. Ideally, at least one NVIDIA GPU is installed with recent drivers as well.
If Docker is not installed on your workstation, you can do so by following the steps below. Otherwise, skip to the next section to verify your Docker installation. It is recommended to follow the latest official Docker installation instructions, but the key steps for Ubuntu and Debian environments have been copied here for convenience. Additionally, steps for installing the NVIDIA Container Toolkit can be found here and are copied below as well.
First, install Docker using the install script:
$ curl https://get.docker.com | sh \
&& sudo systemctl --now enable docker
Next, install the NVIDIA Container Toolkit which adds support for using NVIDIA GPUs inside containers. If you do not have an NVIDIA GPU, you may skip to the next section.
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
Next, update your package manager and install nvidia-docker2:
$ sudo apt update
$ sudo apt install -y nvidia-docker2
Finally, restart the Docker service to complete the installation:
$ sudo systemctl restart docker
By default, Docker is only executable with root privileges either as the root user or by using sudo
. To run Docker without root, you will need to add the desired user to the docker
group. This can be done by running the following (you may replace $USER
with any specific user on your workstation):
$ sudo usermod -aG docker $USER
After adding the user to the docker
group, logout and log back in for any users that were added for the changes to be reflected. Once done, all specified users can now use Docker without root privileges.
NVIDIA GPU support was added to Docker at version 19.03. In order to test with GPUs, you will need to be running with this version or newer. To check your version, run:
$ docker --version
If this shows “Docker version 19.03” or a newer version, your Docker installation is supported. If it shows a version prior to 19.03, follow the instructions above to install a recent version of Docker including the NVIDIA Container Toolkit as necessary.