├── cross-docker └── README.md /cross-docker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$#" -lt 2 ] 4 | then 5 | printf "usage: $0 run [docker args]\n" 6 | exit 1 7 | fi 8 | 9 | if [ $1 != "run" ] 10 | then 11 | printf "first argument must be run\n" 12 | exit 1 13 | fi 14 | 15 | shift 16 | 17 | if [ ! -f /tmp/qemu-static ] 18 | then 19 | mkdir -p /tmp/qemu-static 20 | (cd /tmp/qemu-static && docker run justincormack/debian-qemu-user tarup.sh | tar xf -) 21 | fi 22 | 23 | for f in /tmp/qemu-static/qemu-*-static 24 | do 25 | ARCH="$(basename $f | sed 's/^qemu-//' | sed 's/-static$//')" 26 | VOLUMES="${VOLUMES} -v $f:/usr/bin/qemu-$ARCH-static" 27 | done 28 | 29 | exec docker run ${VOLUMES} $* 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cross-docker 2 | 3 | This is a wrapper script to let you run different architecture containers with qemu-user 4 | 5 | ## Prerequisites 6 | 7 | You must be running in an environment with a working `binfmt_misc` setup. On Debian, if you 8 | install the `qemu-user-static` package that should be sufficient. On other systems make 9 | sure that the `binfmt_misc` pseudo filesystem is mounted (and configured). 10 | 11 | ## How to use it 12 | 13 | ``` 14 | ./cross-docker run -it armv7/armhf-ubuntu uname -a 15 | Linux a6722bd5dabb 4.1.12 #1 SMP Mon Jan 4 11:26:42 UTC 2016 armv7l armv7l armv7l GNU/Linux 16 | ``` 17 | 18 | The first time you use it it will download the `qemu` binaries. 19 | 20 | ## I am too lazy even to do that 21 | 22 | If your docker container already has the `qemu` binary in, you do not need this, eg 23 | `docker run resin/armv7hf-debian uname -a` or `docker run justincormack/ppc64le-debian uname -a`. 24 | 25 | ## Architectures 26 | 27 | If your `binfmt_misc` is set up right the following architectures should be supported: 28 | 29 | ``` 30 | aarch64 31 | alpha 32 | arm 33 | armeb 34 | cris 35 | i386 36 | m68k 37 | microblaze 38 | microblazeel 39 | mips 40 | mips64 41 | mips64el 42 | mipsel 43 | mipsn32 44 | mipsn32el 45 | or32 46 | ppc 47 | ppc64 48 | ppc64abi32 49 | ppc64le 50 | s390x 51 | sh4 52 | sh4eb 53 | sparc 54 | sparc32plus 55 | sparc64 56 | unicore32 57 | x86_64 58 | ``` 59 | --------------------------------------------------------------------------------