Install docker-compose on Raspberry Pi

Introduction

I have recently been experimenting with docker on a raspberry pi at home. In case you don’t know docker is a pretty popular developer tool. You can find pretty much all the info you want on the internet so I am not going to explain much here. All I am going to say is that docker makes it easier for a developer to test and deploy applications with all the dependencies pre-built into a package called container.

Docker-compose takes docker containers a step further. Whereas docker cli helps you deploy a docker container, docker-compose helps you with a push of a button (or enter) to deploy multiple containers with pre-set configuration. More in the official pages or where else … the internet.

The installation of docker-compose on a Raspberry Pi is kind of problematic at least at the time of writing it hence the reason for this post.

The problem

So after installing docker I followed like a good boy the instructions to install docker-compose in Linux here.

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

I make it executable

sudo chmod +x /usr/local/bin/docker-compose

then when I try to verify the version I get command not found

docker-compose --version

the output is 
/usr/local/bin/docker-compose: line 1: Not: command not found

Oooops.

If you try to see the contents of the docker-compose file you realise that it only contains the string Not Found

No wonder it does not work. So basically the curl command above did not retrieve the actual file. In order to find our why, let’s see what file is downloaded with that curl command. What does docker-compose-$(uname -s)-$(uname -m) return on our raspberry pi ?

pi@raspberrypi:~ $ docker-compose-$(uname -s)-$(uname -m)
-bash: docker-compose-Linux-armv7l: command not found
pi@raspberrypi:~ $

So the file is docker-compose-Linux-armv7l and the path is https://github.com/docker/compose/releases/download/1.29.2/

Going to the above URL gives us a 404 so let’s try the releases page https://github.com/docker/compose/releases

If we go to that page we see a whole lot of releases newer than 1.29.2. At the time of writing the stable one is v2.1.1 but that’s probably going to change when you read this article. If we go to the 1.29.2 version we see this

Do you see our file docker-compose-Linux-armv7l ? I don’t.

That’s why you get the Not found error. There is no package for our processor architecture. In the case of Raspberry Pi 3B+ this is armv7l. You can get your architecture by typing this in your shell

pi@raspberrypi:~ $ uname -m
armv7l
pi@raspberrypi:~ $

Solution

Now let’s go to the latest stable release v2.1.1. This is going to be different when you read this article.

A lot more files but still not armv7l so we are going to get the same error if we issue the curl command for this version. But in this release I see a file that resembles the one we want, namely docker-compose-linux-armv7.

Now what is the difference between armv7l and armv7? I will not pretend I am an expert but I believe this has nothing to do with the processor itself which is armv7 but with the packages compiled in little-endian instead of for example hard-float (armhf)

You can clearly see that raspberry’s architecture is armv7 with the following command

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 89.60
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 89.60
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 89.60
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 89.60
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a020d3
Serial          : 000000005078db4c
Model           : Raspberry Pi 3 Model B Plus Rev 1.3

What this really means is that we can actually download and install the armv7 version without issues. Let’s give it a shot.

 sudo curl -L "https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-linux-armv7" -o /usr/local/bin/docker-compose

Et voila!

pi@raspberrypi:~ $ docker-compose --version
Docker Compose version v2.1.1
pi@raspberrypi:~ $

No need to use the alternative method to install docker-compose using python’s pip nor any other dodgy workaround. Pretty simple when you start digging around !

5 Comments

  1. Thank you! I couldnt figure out why curl wasnt downloading the package until I saw your post. Well done. I just wish you would have continued with the rest of the install tutorial

  2. Thank you for this guidance.
    Echoing Ryn: I just wish you would have continued with the rest of the install tutorial

    In my case on 4-15-2022 I found version 2.4.1
    sudo curl -L “https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-armv7” -o /usr/local/bin/docker-compose
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 663 100 663 0 0 2959 0 –:–:– –:–:– –:–:– 2946
    100 22.1M 100 22.1M 0 0 16.5M 0 0:00:01 0:00:01 –:–:– 22.4M

    Now when I look at docker-compose –version
    I am getting the following output – wonder why.
    $ docker-compose –version
    bash: /usr/local/bin/docker-compose: Permission denied

    1. Hello Dominic. Try the command with sudo ? If that works then try giving permissions to the docker-compose file with the following command : sudo chmod a+x /usr/local/bin/docker-compose

  3. Hi Chris,
    I changed the permission as shown below and now it is working.
    sudo chmod +x /usr/local/bin/docker-compose

    ~$ docker-compose –version
    ~$ Docker Compose version v2.4.1

    Thank you.

Leave a Comment

Your email address will not be published. Required fields are marked *

This website uses cookies. By continuing to use this site, you accept our use of cookies.