<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ethan</title>
    <description>The latest articles on DEV Community by Ethan (@et813).</description>
    <link>https://dev.to/et813</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F392135%2F74554283-0a5b-4263-9cb2-b76f6e3c9022.png</url>
      <title>DEV Community: Ethan</title>
      <link>https://dev.to/et813</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/et813"/>
    <language>en</language>
    <item>
      <title>Install Docker and NVIDIA container</title>
      <dc:creator>Ethan</dc:creator>
      <pubDate>Sat, 23 May 2020 09:26:03 +0000</pubDate>
      <link>https://dev.to/et813/install-docker-and-nvidia-container-m0j</link>
      <guid>https://dev.to/et813/install-docker-and-nvidia-container-m0j</guid>
      <description>&lt;h2&gt;
  
  
  Goal
&lt;/h2&gt;

&lt;p&gt;Install Docker, NVIDIA Containter Toolkit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment
&lt;/h2&gt;

&lt;p&gt;Check OS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /etc/lsb-release
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Check GPU&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /etc/lsb-release 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;OS: Ubuntu 18.04&lt;br&gt;
GPU: GeFOrce RTX 2070&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation of Docker
&lt;/h2&gt;

&lt;p&gt;Docker&lt;/p&gt;

&lt;p&gt;Refer the step &lt;a href="https://docs.docker.com/engine/install/ubuntu/"&gt;docker docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set up the repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Add Docker's official GPG key&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Verify that I have key with the fingerpront.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-key fingerprint 0EBFCD88
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Use the following command to set up the stable repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Install Docker engine&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Verify that Docker Engine is installed correctly&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker run hello-world
docker -v
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Installation of NVIDIA conatiner
&lt;/h2&gt;

&lt;p&gt;Refer the step &lt;a href="https://github.com/NVIDIA/nvidia-docker/tree/master#quickstart"&gt;nvida Container Toolkit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the NVIDIA Containter Tool kit system:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hipeEf_k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1ec4rgoxzh58wey66ye3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hipeEf_k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1ec4rgoxzh58wey66ye3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the site,&lt;br&gt;
"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.&lt;br&gt;
"&lt;/p&gt;

&lt;p&gt;In my case, CUDA toolkit has been already installed.&lt;br&gt;
Then, I skipped this step.&lt;/p&gt;

&lt;p&gt;Add the package repositories&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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 &amp;amp;&amp;amp; sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Reboot&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Check installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvidia-container-cli info
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)"&gt;Test&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --gpus all nvidia/cuda nvidia-smi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I confirmed that nvidia-smi worked.&lt;/p&gt;

&lt;p&gt;How to use docker:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/"&gt;https://docs.docker.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>nvidia</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
