Docker on ARM
For a project i'm working on i needed to run docker on a cubietruck,
this boards use a dual core cortex A7 so i needed it to run on ARM
architectures. In the docker web page there's a mention that i works
on ARM and other architectures.
Compilation
Befora i tried to create a package or install it system wide i tried to compile it on the cubietruck, it was pleasant to see that i compiled without any problems:
git clone <docker sources> cd docker hack/make.sh dynbinary
Once it compiled i tried to run it, this time i got dissapointed
$ docker -D -d -H unix:///var/run/docker.sock The Docker runtime currently only supports amd64 (not arm). This will change in the future. Aborting.
Apparently the upstream guys don't think it is a good idea to run it on
ARM architectures. Since i know that LXC is working with no problem in the
the latest Linux kernels i put myself to the task of making it work.
A little grepping showed that there's just one if that aborts the execution
on non x86_64 architectures (for some reason the go language identifies it as
amd64) so i created a little patch [1] to make it work.
func checkKernelAndArch() error { // Check for unsupported architectures - if runtime.GOARCH != "amd64" { - return fmt.Errorf("The Docker runtime currently only supports amd64 (not %s). This will change in the futu re. Aborting.", runtime.GOARCH) + if (runtime.GOARCH != "amd64") && (runtime.GOARCH != "arm") { + return fmt.Errorf("The Docker runtime currently only supports amd64 or arm (not %s). This will change in t he future. Aborting.", runtime.GOARCH) } // Check for unsupported kernel versions // FIXME: it would be cleaner to not test for specific versions, but rather
Compiled it again and this time docker run without problems! :)
Packaging
Since i've been spending a lot of time building RPM packages i cloned the
package from the fedora git repos and added the patch to it.
change ExclusiveArch to {%go_arches}
It's important to set:
export GOROOT=/usr/lib/golang export GOPATH=/usr/share/gocode
'This are raw notes
'