Wednesday, June 15, 2016

running x86 containers on your ppc64le system

My last post was about running other architectures' containers on your laptop. This one's about running x86_64/amd64 containers on your ppc64le system!

If you didn't read the previous post, and want to know how this works, here is is: http://christycodes.blogspot.com/2016/06/running-cross-arch-container-images-on.html

Here's how you can do this (informational items in gray):
~> uname -m
ppc64le


1. Get the qemu emulator binaries:
~> apt-get download qemu-user-static
~> ls qemu-user-static_1%3a2.5+dfsg-5ubuntu10.1_ppc64el.deb
qemu-user-static_1%3a2.5+dfsg-5ubuntu10.1_ppc64el.deb
~> sudo dpkg --force-all -i qemu-user-static_1%3a2.5+dfsg-5ubuntu10.1_ppc64el.deb
Note: I intentionally didn't use apt-get install for qemu-user-static because I didn't want the binfmt-utils package.

2. Get/run the container that registers the binfmt hooks:
  ~> mkdir multiarch && cd multiarch && git clone https://github.com/clnperez/qemu-user-static.git && cd qemu-user-static/register
~> docker build -t multiarch/qemu-user-static:register .
~> ls /proc/sys/fs/binfmt_misc/
register  status

~> docker run --rm --privileged multiarch/qemu-user-static:register
~> ls /proc/sys/fs/binfmt_misc/
aarch64  alpha  arm  armeb  i386  i486  m68k  mips  mips64  mips64el  mipsel  mipsn32  mipsn32el  register  s390x  sh4  sh4eb  sparc  status


3. Run your x86 image:
> docker run --rm -v /usr/bin/qemu-x86_64-static:/usr/bin/qemu-x86_64-static busybox uname -a
Linux 77ce603ac0f1 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:35 UTC 2016 x86_64 GNU/Linux
warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]


Note: That TCG error means that there's a missing CPU feature, but I'm not entirely sure that TCG doesn't support vmx, so I'm going to ask around.



2 comments:

  1. I have tried the same like below,

    root@b64-linux1:~/docker_selenium_trials/multiarch/qemu-user-static/register# docker run --rm -v /usr/bin/qemu-x86_64-static:/usr/bin/qemu-x86_64-static elgalu/selenium uname -a
    standard_init_linux.go:211: exec user process caused "exec format error"
    root@b64-linux1:~/docker_selenium_trials/multiarch/qemu-user-static/register#
    But still the issue persists

    ReplyDelete
    Replies
    1. sorry the above command was wrong, here it is,
      root@b64-linux1:~/docker_selenium_trials/multiarch/qemu-user-static/register# docker run --rm -v /usr/bin/qemu-x86_64-static:/usr/bin/qemu-x86_64-static elgalu/selenium
      standard_init_linux.go:211: exec user process caused "exec format error"
      root@b64-linux1:~/docker_selenium_trials/multiarch/qemu-user-static/register#

      Basically i was trying to run a selenium docker image build with x86 on a Power8 system

      Delete