dependant on Linux kernel?
Closed this issue · 8 comments
I came here from https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/ Very interesting. Thank You!
Using your instructions above I cannot get my Docker image to run. So I tried something like: docker run -it petrosagg/armv7hf-python-dockerhub /bin/bash
, and I get:
panic: standard_init_linux.go:175: exec user process caused "exec format error" [recovered]
panic: standard_init_linux.go:175: exec user process caused "exec format error"
goroutine 1 [running, locked to thread]:
panic(0x7ea960, 0xc82012cd90)
/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/urfave/cli.HandleAction.func1(0xc8200fb2e8)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:478 +0x38e
panic(0x7ea960, 0xc82012cd90)
/usr/local/go/src/runtime/panic.go:443 +0x4e9
github.com/opencontainers/runc/libcontainer.(*LinuxFactory).StartInitialization.func1(0xc8200fabf8, 0xc82001e0d0, 0xc8200fad08)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux.go:259 +0x136
github.com/opencontainers/runc/libcontainer.(*LinuxFactory).StartInitialization(0xc82005d630, 0x7fcc75cf2728, 0xc82012cd90)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux.go:277 +0x5b1
main.glob.func8(0xc82007aa00, 0x0, 0x0)
/go/src/github.com/opencontainers/runc/main_unix.go:26 +0x68
reflect.Value.call(0x74f160, 0x900ae8, 0x13, 0x846e88, 0x4, 0xc8200fb268, 0x1, 0x1, 0x0, 0x0, ...)
/usr/local/go/src/reflect/value.go:435 +0x120d
reflect.Value.Call(0x74f160, 0x900ae8, 0x13, 0xc8200fb268, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/reflect/value.go:303 +0xb1
github.com/urfave/cli.HandleAction(0x74f160, 0x900ae8, 0xc82007aa00, 0x0, 0x0)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:487 +0x2ee
github.com/urfave/cli.Command.Run(0x849d38, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8dfde0, 0x51, 0x0, ...)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/command.go:191 +0xfec
github.com/urfave/cli.(*App).Run(0xc820001b00, 0xc82000a100, 0x2, 0x2, 0x0, 0x0)
/go/src/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/urfave/cli/app.go:240 +0xaa4
main.main()
/go/src/github.com/opencontainers/runc/main.go:137 +0xe24
I am running on:
Linux lambert 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I saw something very similar until I realised I needed to grab armv7hf-debian-qemu into the directory I'm building the image and add this to my Dockerfile:
RUN [ "cross-build-start" ]
# all of my docker commands
RUN [ "cross-build-end" ]
But your own Dockerfile already has those? As mentioned, I tried to run your: docker run -it petrosagg/armv7hf-python-dockerhub /bin/bash
and got the same error.
@SiKing cross-build-start
and cross-build-end
denote sections in the Dockerfile that should be ran using QEMU emulation. You can have multiple sections like so:
RUN [ "cross-build-start" ]
# some commands
RUN [ "cross-build-end" ]
RUN [ "cross-build-start" ]
# some other commands
RUN [ "cross-build-end" ]
Since you're attempting to do a docker run
on the resulting image your command is being ran after the last cross-build-end
. Furthermore, even if you removed the last cross-build-end
you'd still have a problem because those directives take advantage of the fact that RUN
commands will invoke /bin/sh
but you're running /bin/bash
instead.
If you want to start an interactive shell using emulation you can use this command:
docker run -it --entrypoint=qemu-arm-static -e QEMU_EXECVE=1 petrosagg/armv7hf-python-dockerhub /bin/bash
Yup. Seems to work with all the extra switches.
Unfortunately, I am no longer on the project where I ran into the problem in the first place. But good to know for the future.
We're also about to include this functionality to every single base image we ship in resin so that this works out of the box
The blog entry, linked above, that led me to here was very detailed and very informative! Any chance there will be another one, describing the changes you are going to release?
There aren't going to be significant functionality changes other than incorporating the method outlined in this repo for all 5000 base images we provide https://docs.resin.io/runtime/resin-base-images/ . This will allow people to do cross builds without having to use this repo or make a custom one.
There will probably be a blog post about it to announce it.