Brestois
Posts: 7
Joined: Wed Jul 22, 2020 7:24 pm

How to run X86 docker images on RPi 4 ?

Thu Jul 30, 2020 9:18 pm

Hi, I am doing big data projects on RPi and I need to run X86 docker images, HBase, Spark, Flink etc.
I found this project https://github.com/AlbrechtL/RPi-QEMU-x86-wine, and Exagear, but both are discontinued.

I want to know if there is a way to get a X86 emulator to run docker inside (so that I could pull all X86 images) ?
Thanks.

W. H. Heydt
Posts: 12784
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: How to run X86 docker images on RPi 4 ?

Thu Jul 30, 2020 9:50 pm

Short answer: Don't.

Longer answer: If you have an x86 simulator running, *and* you have a program that will convert Windows API calls to Linux API calls, then you can get x86 code to run on a PI. However, it will likely run *exceedingly* slow. So slow that it's not worth the effort. Remember that you are having to convert each and every x86 machine instruction into one or more ARM instructions as they are encountered.

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to run X86 docker images on RPi 4 ?

Thu Jul 30, 2020 9:52 pm

This sounds impossible to me.

I might be wrong but don't programs running inside Docker containers use the same kernel underneath as programs running outside of containers?

Which implies any x86-64 emulation would have to run the entire stack, the an x86-64 kernel, enough user land to run Docker, the Docker container and the programs inside it.

If all that could ever be made to work it would be as slow as a slow thing on a slow day.

Better to rebuild your Docker container for ARM.
Memory in C++ is a leaky abstraction .

LTolledo
Posts: 3585
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 9:08 am

get x86 boards to run your project

end of your problem.....
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

Brestois
Posts: 7
Joined: Wed Jul 22, 2020 7:24 pm

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 9:54 am

Is there any solution to spin up HBase cluster rather than using Docker on a single RPi ?

GlowInTheDark
Posts: 741
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 10:38 am

I know the standard answer to the ever-perennial question "How do I run DOS/WIndows/x86_Linux on the Rpi?" is "You can't".

However, that said, the correct answer is, of course, "You can, but it will be very slow".

However, that said, it did work, sort of, in the old days - using QEMU and old versions of Windows. I.e., don't expect to run "Windows 10" on it (not that anyone would want to).

Which all leads to, now that we have the Pi4, which seems to have finally solved the CPU/RAM bottlenecks of the earlier Pi models, it seems to me that it should be doable nowadays - with a sufficiently souped up Pi4 and a sufficiently old version of Windows.

A couple of notes:
1) I personally haven't ever tried this - running Windows on Pi - simply because I no longer have any interest in it. I used to have one specific app that I needed to run, and which did run quite nicely under WIne on x86_Linux, but that app is no longer relevant (i.e., it is broken for reasons which are outside the scope of this posting).

2) It is a testament to the high level of support that the Rpi provides that people would rather try to run their x86 stuff on a Pi, than do the obvious thing of purchasing and using x86-based boards. So, score one up for the Pi there!
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

richrussell
Posts: 39
Joined: Thu Jan 16, 2020 10:52 am

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 10:46 am

Ultimately if you need to run x86 binaries then the Pi is almost always going to be the wrong tool for the job. If you can compile the application to run on ARM, then it may well be suitable. Whilst it is technically possible to run x86 code, it's never going to be a good solution as it's simply not designed to do that.

Kind of like saying that I could use a Ford Mondeo to plough a field. Yes, it'll probably be able to do it but it won't be anywhere near as good as using a tractor, which is ideally suited to do the job. But if it came to transporting a family of four to the seaside, the Mondeo would be the better choice.

If you absolutely have to use a Raspberry Pi in your project, then you could use it as a front end to control the execution of the Docker containers on a second x86 based single board computer (of which there are many, some quite keenly priced) running x86 Linux natively.

hippy
Posts: 7908
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 11:00 am

GlowInTheDark wrote:
Fri Jul 31, 2020 10:38 am
I know the standard answer to the ever-perennial question "How do I run DOS/WIndows/x86_Linux on the Rpi?" is "You can't".

However, that said, the correct answer is, of course, "You can, but it will be very slow".
And yet ExaGear did appear to work and work well enough for many programs which would seem to fit into the 'won't work' and 'won't be usable' categories.

It seems to me that most of the negativity, the discouragement, comes from those who don't want see it succeed, don't want their ARM or Linux platforms 'contaminated' by X86 or Microsoft.

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: How to run X86 docker images on RPi 4 ?

Fri Jul 31, 2020 11:25 am

hippy wrote:
Fri Jul 31, 2020 11:00 am
It seems to me that most of the negativity, the discouragement, comes from those who don't want see it succeed, don't want their ARM or Linux platforms 'contaminated' by X86 or Microsoft.
I think it's more about managing people's expectations ....
Can you imagine the number of complaints about poor performance if the default line was "yes you can, use an x86 emulator" ?
It's more about managing expectations ....
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

GlowInTheDark
Posts: 741
Joined: Sat Nov 09, 2019 12:14 pm

Re: How to run X86 docker images on RPi 4 ?

Sun Aug 02, 2020 1:58 pm

I think you are both right. That there is some "We don't want no stinkin' WInBlows cr*p on our lovely Linux based Pi" sentiment both here on the board and in Pi Towers. But also that nobody wants to be in the position of having running Windows stuff be a supported feature of the platform - and, thus, having to support it.

That said, in my day-dreams, I wonder how much longer it will be until the folks at Pi Towers come up with an x86 based board. I can already hear the howls of protest, but if you look at this with a clear mind, you'll see that it is a good idea. Probably not anytime soon, but long-term, it is a very good idea.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
PeterO
Posts: 5951
Joined: Sun Jul 22, 2012 4:14 pm

Re: How to run X86 docker images on RPi 4 ?

Sun Aug 02, 2020 2:16 pm

GlowInTheDark wrote:
Sun Aug 02, 2020 1:58 pm
Probably not anytime soon, but long-term, it is a very good idea.
Unless you can actually explain why you think it is a good idea all you've done is state your own belief as fact :roll:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to run X86 docker images on RPi 4 ?

Sun Aug 02, 2020 3:09 pm

GlowInTheDark wrote:
Sun Aug 02, 2020 1:58 pm
I can already hear the howls of protest, but if you look at this with a clear mind, you'll see that it is a good idea.
I'm have often been told I am empty headed. As such I must have a very clear mind. Thinks... hmmm... no, it's not coming to me.

Please do tell. Why would an x86 based Raspberry Pi be a good idea?

If you are desperate to turn your dreams into reality perhaps you should just get an x86 based SBC: https://www.seeedstudio.com/ODYSSEY-X86 ... -4445.html
Memory in C++ is a leaky abstraction .

hippy
Posts: 7908
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to run X86 docker images on RPi 4 ?

Sun Aug 02, 2020 3:22 pm

GlowInTheDark wrote:
Sun Aug 02, 2020 1:58 pm
That said, in my day-dreams, I wonder how much longer it will be until the folks at Pi Towers come up with an x86 based board.
I can't see that happening. RPF's work is platform agnostic so shouldn't matter much to them, so long as money keeps rolling in. But RPT don't seem to be an X86 shop in any manner or form, so don't appear to be in a position to leverage X86 hardware to their advantage as they can with ARM.

Now a RISC-V based board ... that's a possibility. I could even envisage some BCM27xx SoC of the future having RISC-V cores embedded alongside the ARM.

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to run X86 docker images on RPi 4 ?

Sun Aug 02, 2020 3:54 pm

hippy wrote:
Sun Aug 02, 2020 3:22 pm
Now a RISC-V based board ... that's a possibility. I could even envisage some BCM27xx SoC of the future having RISC-V cores embedded alongside the ARM.
Now that it looks likely that ARM will be bought by Nvidia it is perhaps time for all those building with ARM to consider getting together and cooking up a RISC-V replacement for their cores.

https://www.theverge.com/circuitbreaker ... hase-rumor
Memory in C++ is a leaky abstraction .

ejolson
Posts: 5477
Joined: Tue Mar 18, 2014 11:47 am

Re: How to run X86 docker images on RPi 4 ?

Mon Aug 03, 2020 6:45 am

Heater wrote:
Thu Jul 30, 2020 9:52 pm
This sounds impossible to me.

I might be wrong but don't programs running inside Docker containers use the same kernel underneath as programs running outside of containers?

Which implies any x86-64 emulation would have to run the entire stack, the an x86-64 kernel, enough user land to run Docker, the Docker container and the programs inside it.
User-mode QEMU binary emulation might allow an x86 docker image to run on a Raspberry Pi. As shown in

viewtopic.php?p=1691235#p1691235

one would expect the resulting speed to be equivalent to half the performance of the Pi B, or about the same as the slot-based 450 MHz Pentium III processors introduced in 1999. Those were pretty nice computers back then.

While it's astonishing to see the Pi 4B execute x86 Linux binaries, I found it even more amusing to run AARCH64 binaries on the Pi Zero.

Return to “General discussion”