DEV Community

Cover image for Install Docker and NVIDIA container
Ethan
Ethan

Posted on

Install Docker and NVIDIA container

Goal

Install Docker, NVIDIA Containter Toolkit.

Environment

Check OS

cat /etc/lsb-release

Check GPU

cat /etc/lsb-release 

OS: Ubuntu 18.04
GPU: GeFOrce RTX 2070

Installation of Docker

Docker

Refer the step docker docs

Set up the repository

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Add Docker's official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that I have key with the fingerpront.

sudo apt-key fingerprint 0EBFCD88

Use the following command to set up the stable repository

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Install Docker engine

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify that Docker Engine is installed correctly

sudo docker run hello-world
docker -v

Installation of NVIDIA conatiner

Refer the step nvida Container Toolkit

This is the NVIDIA Containter Tool kit system:

Alt Text

According to the site,
"Make sure you have installed the NVIDIA driver and Docker 19.03 for your Linux distribution Note that you do not need to install the CUDA toolkit on the host, but the driver needs to be installed.
"

In my case, CUDA toolkit has been already installed.
Then, I skipped this step.

Add the package repositories

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

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker

Reboot

sudo reboot

Check installation

nvidia-container-cli info

Test

docker run --gpus all nvidia/cuda nvidia-smi

I confirmed that nvidia-smi worked.

How to use docker:

https://docs.docker.com/

Top comments (0)