How do I build docker-compose from source for Linux?

I have an embedded Linux device (armhf) running Ubuntu that I would like to run docker-compose on. There seems to be a pre-built .deb file for Docker itself (and I was able to run dpkg -i to install it), but docker-compose binaries only exist for the amd64 architecture. Thus, I am trying to build docker-compose, but there aren’t really any good instructions in the git README.md for how to accomplish this task. I looked at the scripts/build/linux file and saw that it basically just runs a clean target and then issues a docker build command. So I issued docker build -t docker-compose -f Dockerfile.armhf ., which successfully built me a new image that runs docker-compose.

I would prefer to build the docker-compose binary for arm, but how do I actually create the binary? I can either build it on the target architecture, or do a cross-compliation with gcc, it doesn’t much matter. I just can’t figure out what the build process actually looks like. Am I missing something obvious? :frowning:

hi @twofifty6 - I’m trying to do a related but very similar task, I was wondering if you found any directions to help you that din’t make it onto this thread?

if there is no direct docker-compose package, you can always install python-pip and use it to install docker-compose.

@meyay thank you for the pointer, I’m diving in at the deep end here as this is my first docker exposure, so trying to work out where I need to start…

This should do the trick:
sudo apt-get install python-pip
sudo pip installieren docker-compose

Sorry @mkubasak but I never did get compilation figured out. I have actually since left the company where I was working on this. If I remember correctly however, we wound up using a multi-stage build in our Dockerfile. The first stage would perform a cross-platform build based on some tools from the balena project. There was a special “cross-build-start” and “cross-build-end” pattern that they had. You can look at their repo for examples. I believe between those cross-build tags, we run the pip install docker-compose pyinstaller as suggested. Then I think we had to RUN pyinstaller docker-compose. In the second stage of the build, we would just do something like COPY --from=compose-build /path/to/docker-compose /path/to/docker-compose to copy it over from the first stage of the build. Depending on where you copy that file, you may need to additionally add that directory to your PATH variable.

Hope that helps!