Build Docker Client for ARMv8

The other day, after successfully building Docker-ce 17.06.0-dev for Odroid C2 which has ARMv8 CPU, i couldn’t find Docker client. Maybe it was just me not building the Docker engine correctly.

Anyway, after some more times, I also managed building the Docker client for the Odroid C2. It turned out, like many things, it wasn’t that  hard after you figured it out. It’s worth to note too that the build instruction on https://github.com/docker/cli is to use Docker container. It didn’t work for me, and I decided to just build the Docker cli locally on the Odroid C2 instead.

First clone the repository:

$ go get github.com/docker/cli
can't load package: package github.com/docker/cli: no Go files in /home/kenno/dev/gowork/src/github.com/docker/cli

So what just happened? Instead of running git clone https://github.com/docker/cli, I use go get command to pull the code from the repo to a path in $GOPATH, since I’m going to build it using go anyway.

Next we can just build it:

$ cd $GOPATH/src/github.com/docker/cli/cmd/docker
go build

When it’s finished, we can run the Docker cli:

Notice that we the Version, “Git commit”, and “Built” fields are set to unknown.

 Version:      unknown-version
 Git commit:   unknown-commit
 Built:        unknown-buildtime

Is there something we can do about? Yes, we can!

$ cd $GOPATH/src/github.com/docker/cli
$ source $GOPATH/src/github.com/docker/cli/scripts/build/.variables
$ go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"

After the compilation, the Docker cli binary file can be found in ./build directory.

Let’s run it again:

The Version field is still “unknown-version”. This makes sense as we build the code from the master branch.

Leave a Reply

Your email address will not be published. Required fields are marked *