Linux - Using curl to get Docker Compose, Link not found?

Sorry if this is the wrong place, there doesn’t seem to be a Linux area.

I’m probably doing something really stupid here but on my Raspberry Pi I’m trying to install Docker Compose as per this guide.

When I run:

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

It makes a file with the contents “Not Found”.

If I try and go to the URL in a browser, I also get a 404 error.

Am I meant to be replacing “$(uname -s)” with my Github login details or something? If so, can I get an example because it implies I should be entering my username twice to replace the “uname”?

first, the uname command is a Unix command and not used for connecting to github.
For Raspberry Pi, you’ll need to use the “alternative method to install docker compose” instructions.

You’ll need python and pip first and then:

sudo pip install docker-compose

And that’s it, you should now be able to run

docker-compose build in your project.

Thank you for this! I did try this but haven’t had much luck. I get to:

sudo pip install docker-compose

And then after a minute or so I get the following red writing:

Command “/usr/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ghUJY3 --no-warn-script-location --no-binary :none: --only-binary :none: -i Simple index --extra-index-url piwheels - Simple index – setuptools>=40.8.0 wheel “cffi>=1.1; python_implementation != ‘PyPy’”” failed with error code 1 in None

Before this error, there is also a “fatal error” that says:

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9NJ3qw/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1

Apologies for this, I’m sure it’s probably straight forward if you know what you’re doing but I’m new to Linux!

I think I’ve made more progress, I had to run the below first:

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

Now when I run Docker-Compose it recognises it but I get an error saying:

ImportError: No module named ssl_match_hostname

Is this normal behavior if I don’t reference a build file?

Also, how does the python version differ from the Linux version? Do I do approach things differently?

Thanks!

For the ImportError question - what version of Docker are you running? Have you tried upgrading?
sudo pip install --upgrade docker

python versions are somewhat dependent on what OS is installed (and version) unless you are building python from scratch (usually aren’t doing it this way). Some OS versions have python2, some have python3 and some have both.

Thanks Todd, I’ve tried upgrading docker and this is the output:

Looking in indexes: Simple index, piwheels - Simple index
Requirement already up-to-date: docker in /usr/local/lib/python2.7/dist-packages (4.0.2)
Requirement already satisfied, skipping upgrade: ipaddress>=1.0.16; python_version < “3.3” in /usr/lib/python2.7/dist-packages (from docker) (1.0.17)
Requirement already satisfied, skipping upgrade: six>=1.4.0 in /usr/lib/python2.7/dist-packages (from docker) (1.12.0)
Requirement already satisfied, skipping upgrade: websocket-client>=0.32.0 in /usr/local/lib/python2.7/dist-packages (from docker) (0.56.0)
Requirement already satisfied, skipping upgrade: requests!=2.18.0,>=2.14.2 in /usr/local/lib/python2.7/dist-packages (from docker) (2.20.1)
Requirement already satisfied, skipping upgrade: backports.ssl-match-hostname>=3.5; python_version < “3.5” in /usr/local/lib/python2.7/dist-packages (from docker) (3.7.0.1)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests!=2.18.0,>=2.14.2->docker) (3.0.4)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests!=2.18.0,>=2.14.2->docker) (2019.6.16)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests!=2.18.0,>=2.14.2->docker) (1.24.3)
Requirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests!=2.18.0,>=2.14.2->docker) (2.7)

After this, docker-compose returns:

Traceback (most recent call last):
File “/usr/local/bin/docker-compose”, line 6, in
from compose.cli.main import main
File “/usr/local/lib/python2.7/dist-packages/compose/cli/main.py”, line 17, in
import docker
File “/usr/local/lib/python2.7/dist-packages/docker/init.py”, line 2, in
from .api import APIClient
File “/usr/local/lib/python2.7/dist-packages/docker/api/init.py”, line 2, in
from .client import APIClient
File “/usr/local/lib/python2.7/dist-packages/docker/api/client.py”, line 10, in
from .build import BuildApiMixin
File “/usr/local/lib/python2.7/dist-packages/docker/api/build.py”, line 6, in
from … import auth
File “/usr/local/lib/python2.7/dist-packages/docker/auth.py”, line 9, in
from .utils import config
File “/usr/local/lib/python2.7/dist-packages/docker/utils/init.py”, line 3, in
from .decorators import check_resource, minimum_version, update_headers
File “/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py”, line 4, in
from . import utils
File “/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py”, line 13, in
from … import tls
File “/usr/local/lib/python2.7/dist-packages/docker/tls.py”, line 5, in
from .transport import SSLHTTPAdapter
File “/usr/local/lib/python2.7/dist-packages/docker/transport/init.py”, line 3, in
from .ssladapter import SSLHTTPAdapter
File “/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py”, line 23, in
from backports.ssl_match_hostname import match_hostname
ImportError: No module named ssl_match_hostname

Is there a way I can essentially reset my Python config? I think it did have Python 2 out of the box which I think might be causing the issue? Do I need Python 3 only? Or how do I exclusively use Python 3’s pip?

Thanks for all your help.

looks like you might have both versions based on the output above. You can look at /usr/local/lib to see for certain.
You could try just removing the python3-dev package and try installing the python2.7-dev instead.
Check out this thread https://github.com/docker/docker-py/issues/1502 for the error you are getting.

Thanks Todd - it seems Python2 was installed by default so I had to specifically use the command “pip3 install docker-compose” to get it to work.

Thanks for all your help, it doesn’t seem to be that smooth on a Raspberry Pi yet. It took me long enough just install docker itself, I had to use “Curl -sfsSL get.docker.com | CHANNEL=nightly sh”

Glad it’s over though, now I can hopefully start to learn how to use it!

1 Like