How to install Docker and Docker Compose on Raspberry Pi?



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. This is a quick demo that shows you how to install Docker on your Raspberry Pi.

I use DigitalOcean for all of my demos, you can use the link below to get a free $100 credit and spin up your own Linux servers!

https://m.do.co/c/2a9bba940f39

Twitter: https://twitter.com/bobbyiliev_
Website: https://bobbyiliev.com

Blog Post with all of the commands in the video:

https://devdojo.com/tutorials/how-to-install-docker-and-docker-compose-on-raspberry-pi

List of the commands used in the video:

Step 1 – Download the Docker install script

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

Step 2 – Run the Docker install script

sudo sh get-docker.sh

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

sudo usermod -aG docker ${USER}

Step 4

sudo su – ${USER}

Step 5 – Test Docker

docker version
docker run hello-world

Step 6 – Install Docker Compose

sudo pip3 install docker-compose

source

17 thoughts on “How to install Docker and Docker Compose on Raspberry Pi?”
  1. For those hitting the following problem during installation of docker-compose
    pi@raspberrypi:~ $ sudo pip3 install docker-compose


    Package libffi was not found in the pkg-config search path.

    Perhaps you should add the directory containing `libffi.pc'

    to the PKG_CONFIG_PATH environment variable

    No package 'libffi' found

    This was resolved with the following command.
    pi@raspberrypi:~ $ sudo apt-get install libffi-dev

    My setup:
    pi@raspberrypi:~ $ uname -a

    Linux raspberrypi 5.4.61-v7l+ #1339 SMP Tue Sep 1 18:51:27 BST 2020 armv7l GNU/Linux

    pi@raspberrypi:~ $ docker-compose version

    docker-compose version 1.27.0, build unknown

    docker-py version: 4.3.1

    CPython version: 3.7.3

    OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019

  2. When installing docker-compose, I get the following error message:

    Collecting docker[ssh]>=5 (from docker-compose)

    Could not find a version that satisfies the requirement docker[ssh]>=5 (from docker-compose) (from versions: 2.0.0, 2.0.1, 2.0.2, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.4.0, 2.4.1, 2.4.2, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.7.0, 3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.2.0, 3.2.1, 3.3.0, 3.4.0, 3.4.1, 3.5.0, 3.5.1, 3.6.0, 3.7.0, 3.7.1, 3.7.2, 3.7.3, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.2.0, 4.2.1, 4.2.2, 4.3.0, 4.3.1, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.4.4)

    No matching distribution found for docker[ssh]>=5 (from docker-compose)

    Does anyone have any ideas?

  3. @Bobby Iliev need your help, bash: sudo: command not found. Why it did not find this command?

  4. First off, helpful video! Maybe somewhat off topic but using this, my current docker-compose version is :
    docker-compose version 1.26.2, build unknown

    docker-py version: 4.3.1

    CPython version: 3.7.3

    OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019

    now when I try to run compose on the .yml file using:

    docker-compose -f ~/docker/docker-compose.yml up -d

    it says The USERDIR variable and TZ variable are not set. Defaulting to a blank string. I have them defined in my /etc/environment but when installed in this way, do you know where it's looking for those variables?

  5. I doubt I might get a reply here, but everytime i run the pip install command for Docker–compose, I get an error when its fetching a package from this website : https://www.piwheels.org/simple/pynacl/packages.htm.

    I seems its down or something, so it just stops the install. I'm looking for a way to get this to work. Im get a docker-compose.sh in theusr/local/bin folder but it only weighs 9 bytes…so it must be wrong.

    Hope you can help. thanks!

  6. Hello,
    Just to tell that the legit "hello-world" container doesn't work on old Raspberry Pi (the first one, at least, which i have). You have to use the "hypriot/armhf-hello-world" equivalent.
    But it works on my new Raspberry 3 B+. They use both ARM. So i wonder why they don't work the same :/

  7. Man, i have python 3.7.3 version but when I command "sudo pip3 install docker-compose" shows "sudo: pip3: command not found" What is the problem?

  8. New to Linux and Docker. Was getting tired of messing things up when trying to install different software by using random tutorials and videos so I figured going with Docker would be a safe bet. Tried running Ubuntu Server but needed to be able to use the GPIO for my case fan and power button; it didn't work out well for me. Wiped that SD and loaded the newest Raspberry OS on RPi 4 8GB, following these instructions for Docker, and the instructions @ierosgr for installing Portainer. Now, I'll keep everything in containers and hopefully not break anything else.

  9. what if you want ot have access to the docker container via web … Do you need extra packages as well? Which ones?

  10. I had some problems getting docker-compose working on pi. This was helpfull. I'm planing on using jwilder/nginx-proxy, pihole and webserver, which I have tested in containers on laptop. Thx for the video.

Leave a Reply

Your email address will not be published.

Captcha loading...