A Raspberry Pi is the perfect small piece of hardware that allows you to run all different kinds of applications, and the most reliable way to do this is using Docker.

Each service is well-isolated in its own container; does not interfere with anything and can be easily removed if you don’t like it.

Now, let’s see how we can get docker and docker-compose up and running.

Docker installation

  1. Install docker
curl -sSL https://get.docker.com | sh
  1. Allow the pi user to run docker commands
sudo usermod -aG docker $(whoami)
  1. Start a new shell (session) or reboot your system

  2. Test installation

docker --version

If successfully installed, the above command should print the docker version

Docker Compose installation

  1. Install dependencies
sudo apt-get install -y libffi-dev libssl-dev python3 python3-pip
  1. Install Docker Compose
sudo pip3 -v install docker-compose
  1. Test installation
docker-compose --version

If successfully installed, the above command should print the docker-compose version

Tip

When you try to start a docker container, and it’s giving you the standard_init_linux.go:207: exec user process caused "exec format error" error, it means the container image is not compatible with the architecture. Raspberry Pi’s use the ARM architecture while the vast majority of docker containers (at this moment) are meant for x64 systems.

Do you use a different or faster method to install docker or docker-compose? Let me know in the comments below ⬇️