Search code examples
dockerdocker-composearmx86-64docker-build

How do I build docker-compose container from source for x86_64 and an arm arch? (Please provide a source image with `from` prior to commit)


I am trying to build the docker-compose container from source. Ultimately I want two of these containers, one for x86_64 and one for an arm arch. I see that I can get the x86 compatible container with this script https://github.com/docker/compose/releases/download/1.25.5/run.sh, but I need to be able to build from source. I have cloned the compose repository and have tried two things, first just trying to build with the Dockerfile in the repo. The result:

>docker build -t docker-compose .
Sending build context to Docker daemon 1.872 MB
Step 1/39 : ARG DOCKER_VERSION=19.03.8
Please provide a source image with `from` prior to commit

I was then looking at the build scripts in script/build and tried executing the linux build script.

> script/build/linux
+ ./script/clean
++ script/build/write-git-sha
+ DOCKER_COMPOSE_GITSHA=9c5351cf
+ TAG=docker/compose:tmp-glibc-linux-binary-9c5351cf
+ docker build -t docker/compose:tmp-glibc-linux-binary-9c5351cf . --build-arg BUILD_PLATFORM=debian --build-arg GIT_COMMIT=9c5351cf
Sending build context to Docker daemon 1.872 MB
Step 1/39 : ARG DOCKER_VERSION=19.03.8
Please provide a source image with `from` prior to commit

I'm stuck here. My plan for the arm container is to use the linux build script but swap the ARCH to my arm architecture. Any help would be appreciated


Solution

  • I will answer this question if anyone happens upon it, because I have solve it. The issue was with my docker-version. You need an up to date docker version, and then clone the docker-compose repo and do docker build like shown above. To build an ARM version I had to make an ARM emulator with Qemu and do the same steps there.