Skip to content

Docker Install

Nate Koenig edited this page Aug 17, 2020 · 5 revisions

These instructions contain information for running SubT simulation software using Docker. We recommend a computer that conforms to the System Requirements, however you may have success with a non-Ubuntu computer. The primary advantage of Docker is that all the software required for SubT is self-contained and does not get installed directly on your system.

Docker has two available versions: Community Edition (CE) and Enterprise Edition (EE). In this tutorial, we'll install the CE version.

Install Docker

  1. Remove old versions of Docker (if installed):

    sudo apt-get remove docker docker-engine docker.io
    
  2. Install dependencies and keys.

     sudo apt install curl apt-transport-https ca-certificates curl software-properties-common
    
     # Add the official GPG key of Docker
     curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  3. Setup Docker using 1 of the two options below.

    1. Ubuntu Bionic users

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

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

     sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli
    
  5. Check your Docker installation:

     sudo docker run hello-world
    
  6. You should see the message Hello from Docker! confirming that your installation was successfully completed.

Install Nvidia Docker

Make sure you have followed the instructions above to install Docker first.

  1. Remove old versions of Nvidia Docker:

     docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
     sudo apt-get purge -y nvidia-docker
    
  2. Setup the Nvidia Docker repository.

     curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
     distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
     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
    
  3. Install Nvidia Docker (version 2):

     sudo apt-get install -y nvidia-docker2
    
  4. Restart the Docker daemon

     sudo service docker restart
    
  5. Verify the installation:

     docker run --runtime=nvidia --rm nvidia/cuda:10.2-base nvidia-smi
     # if that command fails because it requires CUDA 10
     # but you have CUDA 9, try the following instead:
     docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
    

    This command should print your GPU information, for example:

    Screenshot from 2018-06-20 08-21-43.png

Troubleshooting:

permission error

If this is the first time you've used Docker on this machine, when you run the above command you may get an error similar to...

    docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.37/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'.

You will need to add your user account the docker group,

    sudo usermod -a -G docker $USER

and then logout-log-back-in for the changes to take effect.

docker: Error response from daemon

If you see an error similar to the following

    docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"process_linux.go:385: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: exec command [/usr/bin/nvidia-container-cli --load-kmods configure --ldconfig=@/sbin/ldconfig.real --device=all --compute --utility --require=cuda>=9.0 --pid=4077 /var/lib/docker/overlay2/882c5e8dd7e64585e210cc885e150bd82f157383d44b5933d4aa82134ac103a9/merged]\\\\nnvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.
    ERRO[0001] error waiting for container: context canceled 

Then you probably need to install nvidia drivers on your host machine using:

    sudo apt-get install nvidia-384

Reboot your machine after installing the drivers.

Clone this wiki locally