Raspberry Pi: Docker – Install Docker on Raspberry Pi

To build and run Docker containers on Raspberry Pi it is required to install Docker itself.

To install the latest version of Docker on Raspberry Pi and to be able to upgrade it easily in future – it is recommended to install Docker from the official repository.

In this guide i will show how to install free Docker CE (Community Edition) on Raspberry Pi (Raspbian) from the stable official repository, how to verify that it has installed correctly and will show the common post-installation steps to perform.

Install Docker on Raspberry Pi

Add Docker’s official GPG key:

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

Set up the stable Docker’s repository:

$ echo "deb [arch=armhf] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker-ce.list

Install Docker and Docker Compose on Raspberry Pi:

$ sudo apt-get update
$ sudo apt-get install docker-ce
$ sudo pip3 install docker-compose

Start Docker:

$ sudo systemctl start docker

Verify that Docker is installed correctly by running the hello-world image:

$ sudo docker run hello-world

Cool Tip: Docker successfully installed! It’s time to run first container! Read More →

Post-Installation Steps

Once Docker is installed on Raspberry Pi, there are few more things left to do.

First of all it is required to configure Docker daemon to start automatically at system boot.

Run the following command to add Docker to autostart:

$ sudo systemctl enable docker

And secondly, add the Raspberry Pi’s user to the docker group to get rid of the need of typing sudo each time you run the docker command:

$ sudo usermod -aG docker $USER

Info: Log out and log back to complete the group assignment.

To verify that you can run docker without sudo, execute:

$ docker run hello-world