How to install Docker and Docker Compose on Raspberry Pi
Bobby Iliev ・ Apr 6th, 2020 Views

How to install Docker and Docker Compose on Raspberry Pi

Introduction

Docker is the de facto standard to build and share containerized apps - from desktop to the cloud. You can basically run Docker virtually anywhere from your DigitalOcean Droplet or your Laptop, to your Raspberry Pi at home.

Raspberry Pi on the other side is a great low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse.

In this tutorial, I will show you how to install Docker and Docker Compose on Raspberry Pi with just a few easy steps!

Installing Docker

I will use the convenience script provided by Docker at get.docker.com for installing edge version of Docker Engine - Community. It is a great way to install Docker on development environments quickly.

Step 1 - Download the Docker install script

To download the convenience script you just need to run the following command:

Note: Always examine scripts downloaded from the internet before running them locally.

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

Step 2 - Run the Docker install script

Execute the installation script:

sudo sh get-docker.sh

Step 3 - Add your user to the Docker group (Optional)

If you would like to use Docker as a non-root user and not have to type sudo each time, you have to add your user to the “docker” group with something like:

sudo usermod -aG docker ${USER}

Step 4

If you ran the previous command, remember to log out and back in for this to take effect! Or instead, run the following command:

Checkout our latest product - the ultimate tailwindcss page creator 🚀
sudo su - ${USER}

Step 5 - Test Docker

Now in order to verify that Docker is installed correctly. You can check the Docker version by running the following command:

docker version

 As another test we can run the hello-world image:

docker run hello-world

Step 6 - Install Docker Compose

I will use pip3 to install Docker Compose. Note that you need to have python3 and pip3 installed already in order to use pip3.

If you don't have python3 installed already, you can run the following commands:

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

Once you have python and pip installed just run the following command:

sudo pip3 install docker-compose

Video Demo

Here's a quick video walkthrough on how to do the above:

How to install Docker and Docker Compose on Raspberry Pi?


Conclusion

This is pretty much it! Now you have Docker installed on your Raspberry Pi and you can start.

Feel free to reach out to me and let me know if you have any questions!

Bobby

Comments (0)