Skip to content

Instantly share code, notes, and snippets.

@oysteinjakobsen
Last active August 7, 2019 14:38
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save oysteinjakobsen/e59cdd38a688ee8a418a to your computer and use it in GitHub Desktop.
Save oysteinjakobsen/e59cdd38a688ee8a418a to your computer and use it in GitHub Desktop.
How to get docker-compose (fig) up and running on Raspberry Pi 2

Background

I assume you already have Docker up and running on your Raspberry Pi 2. If not, see this article.

The next natural step is to install Docker Compose (formerly Fig), but there's no ARM support out of the box. This recipe will help you install Docker Compose on your Raspberry Pi 2!

The following six steps will do the trick:

  1. Get the docker-compose source code from git
  2. Build docker-compose
  3. Extract the build from the docker container
  4. Move the extracted files to their positions
  5. Install python
  6. Test your installation

Disclaimer: I've tested this on the Debian Wheezy image described in the referenced article, so your mileage may vary...

Get the docker-compose source code from git

First step is to get the Docker Compose source code from GitHub:

git clone https://github.com/docker/fig

Build docker-compose

Now you should build Docker Compose. The build process takes place inside a Docker container. The result is a Python script.

cd fig
docker build -t rpi-docker-compose .

Extract the build from the docker container

There is actually a complete build script that produces a binary, but ARM is not supported. That's why we need to do some additional steps on the Raspberry. The next step is to extract the Python code.

mkdir $HOME/dc-files
docker run -it --rm -v $HOME/dc-files:/data --entrypoint /bin/bash rpi-docker-compose

Move the extracted files to their positions

cp /usr/local/bin/docker-compose /data
cp -r /usr/local/lib/python2.7/dist-packages/ /data
exit
sudo cp $HOME/dc-files/docker-compose /usr/local/bin
sudo mkdir /usr/local/lib/python2.7
sudo cp -r $HOME/dc-files/dist-packages /usr/local/lib/python2.7

Install python

sudo apt-get install python python-pkg-resources

Test your installation

docker-compose --version
@stealthdave
Copy link

sudo apt install -y docker-compose

Currently, this only installs version 1.8, where the latest is 1.22, and there are significant changes between the two, including support for version: 3 yaml files. However, the pip install method does install the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment