Deep Learning

If you are involved in deep learning at Imperial you will know the difficulty in installing and configuring all the drivers, libraries and packages on your computer.

To promote and aid a standard deep learning environment we recommend adopting Docker and the Deepo image.

It contains most popular deep learning frameworks: theano, tensorflow, sonnet, pytorch, keras, lasagne, mxnet, cntk, chainer, caffe, torch.

Quick Start

Step 1. Install Docker and nvidia-docker.

Step 2. Obtain the Deepo image

Get the image from Docker Hub (recommended)
docker pull ufoym/deepo


Now you can try this command:

nvidia-docker run --rm ufoym/deepo nvidia-smi

This should work and enables Deepo to use the GPU from inside a docker container. If this does not work, search the issues section on the nvidia-docker GitHub — many solutions are already documented. To get an interactive shell to a container that will not be automatically deleted after you exit do

nvidia-docker run -it ufoym/deepo bash

If you want to share your data and configurations between the host (your machine or VM) and the container in which you are using Deepo, use the -v option, e.g.

nvidia-docker run -it -v /host/data:/data -v /host/config:/config ufoym/deepo bash

This will make /host/data from the host visible as /data in the container, and /host/config as /config. Such isolation reduces the chances of your containerized experiments overwriting or using wrong data.

Containers and Machine Learning

Docker Engine Utility for NVIDIA GPUs



Assuming the NVIDIA drivers and Docker® Engine are properly installed (see installation)

Ubuntu distributions

# Install nvidia-docker and nvidia-docker-plugin
wget -P /tmp
sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb

# Test nvidia-smi
nvidia-docker run --rm nvidia/cuda nvidia-smi

CentOS distributions

# Install nvidia-docker and nvidia-docker-plugin
wget -P /tmp
sudo rpm -i /tmp/nvidia-docker*.rpm && rm /tmp/nvidia-docker*.rpm
sudo systemctl start nvidia-docker

# Test nvidia-smi
nvidia-docker run --rm nvidia/cuda nvidia-smi

Installing Docker on Ubuntu

To install Docker CE, you need the 64-bit version of one of these Ubuntu versions:

  • Zesty 17.04
  • Xenial 16.04 (LTS)
  • Trusty 14.04 (LTS)


  1. Update the apt package index:
    $ sudo apt-get update
  2. Install packages to allow apt to use a repository over HTTPS:
    $ sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
  3. Add Docker’s official GPG key:
    $ curl -fsSL | sudo apt-key add -

    Verify that you now have the key with the fingerprint9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

    $ sudo apt-key fingerprint 0EBFCD88
    pub   4096R/0EBFCD88 2017-02-22
          Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
    uid                  Docker Release (CE deb) <>
    sub   4096R/F273FCD8 2017-02-22
  4. Use the following command to set up the stablerepository. You always need the stable repository, even if you want to install builds from the edge or testrepositories as well. To add the edge or test repository, add the word edge or test (or both) after the word stable in the commands below.

    Note: The lsb_release -cs sub-command below returns the name of your Ubuntu distribution, such as xenial. Sometimes, in a distribution like Linux Mint, you might have to change $(lsb_release -cs) to your parent Ubuntu distribution. For example, if you are usingLinux Mint Rafaela, you could use trusty.


    $ sudo add-apt-repository \
       "deb [arch=amd64] \
       $(lsb_release -cs) \


    1. Update the apt package index.
      $ sudo apt-get update
    2. Install the latest version of Docker CE, or go to the next step to install a specific version. Any existing installation of Docker is replaced.
      $ sudo apt-get install docker-ce

      Configure Docker to start on boot

      Most current Linux distributions (RHEL, CentOS, Fedora, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. Ubuntu 14.10 and below use upstart.


      $ sudo systemctl enable docker

      To disable this behavior, use disable instead.

      $ sudo systemctl disable docker

      If you need to add an HTTP Proxy, set a different directory or partition for the Docker runtime files, or make other customizations, see customize your systemd Docker daemon options.


      Docker is automatically configured to start on boot usingupstart. To disable this behavior, use the following command:

      $ echo manual | sudo tee /etc/init/docker.override


      $ sudo chkconfig docker on