How to set up Docker on Raspberry Pi

Docker is a platform to develop, deploy, and run container apps. It’s gained popularity because it speeds up the development process and does not use a lot of resources when compared to virtual machines.

Update Apt-Get

Let's first start by ensuring we have the latest updates by running the following command in the terminal.
sudo apt-get update && sudo apt-get upgrade

Install Docker

Run the following commands to install docker

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

Add Permissions

Add permissions so that you don’t always have to use sudo.

sudo usermod -aG docker pi

Test Docker

Test that docker has been installed properly by running the following command:

docker run hello-world

Install Docker-Compose

Run the following steps in order to install docker-compose.

sudo apt-get install -y libffi-dev libssl-dev

sudo apt-get install -y python3 python3-pip

sudo apt-get remove python-configparser

sudo pip3 -v install docker-compose

Caveat

It’s important to remember that because the Raspberry Pi uses the ARM architecture, it will not be compatible with all containers. Images need to be created from a base image of the ARM. These images can easily be found on the Docker Hub.

Conclusion

You are now ready to use Docker on your Raspberry Pi and use containers to build isolated and lightweight software.

See here and here for further reading on the topic.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store