Knowledge for the World

How to install Docker on your Raspberry Pi

Docker is a tool that allows you to deploy applications inside of software containers. This can be useful for the Raspberry Pi because it allows users to run applications with very little overhead, as long as the application is packaged inside of a Docker image. You simply install Docker and run the container. This guide will walk you through the process of installing Docker on any version of Raspbian.

Important Note

Update: Although this guide is still relevant, some people are experiencing issues with the add-apt-repository command. I've added a note in the appropriate step below for those that wish to follow the guide I've laid out, but I believe the best way moving forward is to use a much simpler method and install directly from get.docker.com. See the example below.

curl -sSL https://get.docker.com | sh
1

Since Raspbian is Debian based, we will use apt to install Docker. But first, we need to update.

sudo apt-get update

2

sudo apt-get install apt-transport-https \
                       ca-certificates \
                       software-properties-common

3

curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -

Verify the correct key id:

apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D

Set up the stable repository:

sudo add-apt-repository \
       "deb https://apt.dockerproject.org/repo/ \
       raspbian-$(lsb_release -cs) \
       main"

Note: If you're experiencing issues with the add-apt-repository command, you can add the line directly to the sources.list file. See below:

sudo vim /etc/apt/sources.list

Append the following:

https://apt.dockerproject.org/repo/ raspbian-RELEASE main

Replace RELEASE with the Raspbian release you're using.

To find your release use:

lsb_release -cs
4

First, update apt again.

sudo apt-get update

Now install Docker Engine.

sudo apt-get -y install docker-engine

5

To test docker we'll run the hello-world image.

sudo docker run hello-world

If Docker is installed properly, you'll see a "Hello from Docker!" message.