Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@CarlosTorrecillas

This comment has been minimized.

Copy link

@CarlosTorrecillas CarlosTorrecillas commented Aug 17, 2016

Is there a version for Debian:Jessie?

@CarlosTorrecillas

This comment has been minimized.

Copy link

@CarlosTorrecillas CarlosTorrecillas commented Aug 17, 2016

Actually I may have found a quicker way to install it:
sudo apt-get -y install python-pip
sudo pip install docker-compose

@cescoferraro

This comment has been minimized.

Copy link

@cescoferraro cescoferraro commented Oct 14, 2016

curl -o /usr/local/bin/docker-compose -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-Linux-x86_64
chmod +x /usr/local/bin/docker-compose
@soriyath

This comment has been minimized.

Copy link

@soriyath soriyath commented Jan 16, 2017

@CarlosTorrecillas great man, much better way to do it.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Feb 5, 2017

@CarlosTorrecillas thank you :)

@alexellis

This comment has been minimized.

Copy link

@alexellis alexellis commented Jul 30, 2017

Compose is supported.. not sure how old this gist is especially because it refers to fig.

@VictorLamoine

This comment has been minimized.

Copy link

@VictorLamoine VictorLamoine commented May 9, 2018

sudo apt install -y docker-compose

@volkan

This comment has been minimized.

Copy link

@volkan volkan commented May 28, 2018

@VictorLamoine thanks.

@stealthdave

This comment has been minimized.

Copy link

@stealthdave stealthdave commented Sep 19, 2018

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
You can’t perform that action at this time.