Skip to content

Instantly share code, notes, and snippets.

@oysteinjakobsen
Last active August 7, 2019 14:38
Show Gist options
  • Select an option

  • Save oysteinjakobsen/e59cdd38a688ee8a418a to your computer and use it in GitHub Desktop.

Select an option

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
@CarlosTorrecillas

Copy link
Copy Markdown

Is there a version for Debian:Jessie?

@CarlosTorrecillas

Copy link
Copy Markdown

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

@cescoferraro

cescoferraro commented Oct 14, 2016

Copy link
Copy Markdown
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

@johnypony3

Copy link
Copy Markdown

@soriyath

Copy link
Copy Markdown

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

ghost commented Feb 5, 2017

Copy link
Copy Markdown

@CarlosTorrecillas thank you :)

@alexellis

Copy link
Copy Markdown

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

@VictorLamoine

Copy link
Copy Markdown

sudo apt install -y docker-compose

@volkan

volkan commented May 28, 2018

Copy link
Copy Markdown

@VictorLamoine thanks.

@stealthdave

Copy link
Copy Markdown

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