18

I need to run MongoDB docker container on Raspberry Pi 4B. My Raspberry has preset (already installed) Raspbian on SD card, I didn't install OS by myself.

MongoDB docker image supports arm64v8. But when I try to run container, it claims that there is no image available for my armv7 32-bit machine.

Official Raspberry Pi 4B specification claims that it has ARMv8 processor so mongodb should install without any problems. It turns out it's not a problem with Mongo, as linux command lscpu also claims my machine is armv7l.

What would you recommend me to do now? Can I somehow configure raspbian so it claim it works on armv8?

Piotrek
  • 283
  • 1
  • 2
  • 5

2 Answers2

13

Docker containers use the same kernel as the host. There are two pre-compiled kernels distributed with Raspbian, an ARMv6 one for the model 1's and Zeros, and an ARMv7 one for the multicore models. The latter works on the 64-bit ARMv8 models as well,1 since they are backward compatible.

You cannot run a 64-bit userspace on top of a 32-bit kernel. While you could use a 64-bit kernel, this means compiling it yourself or finding a distro that has one.

Unfortunately Mongo DB dropped support for 32-bit platforms last year. Your best bet is to try a 64-bit distro; if you search around online you'll find blogs about this, eg.: https://andyfelong.com/2019/01/mongodb-3-2-64-bit-running-on-raspberry-pi-3-with-caveats/

2020 Update: There is a beta version of 64-bit Raspbian/RpiOS available which seems to work fine and thus should support MongoDB.


  1. The oddball in this is really the Pi 2B, which is a 32-bit ARMv7 dual core. This is when the second stock kernel was introduced.
goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • Thank you very much, I think I understand the problem now. It seems they the easiest way is to install an 64-bit distro. Do you recommend any? If some Linux distro supports Raspberry Pi 3, will it also run on RPi4? – Piotrek Jul 31 '19 at 18:52
  • You should make new questions about your additional questions. – Ingo Jul 31 '19 at 19:30
  • I'd start with Debian buster, which is what's used in the blog from the link. Raspbian is based on it (notice the current version is also "buster") and largely identical, which should make other things easier for you. – goldilocks Jul 31 '19 at 19:42
  • The oddball in this is really the Pi 2B, which is a 32-bit ARMv7 dual core - isn't there two "versions" of the 2B? the latter having the same SOC as the 3B? (just to confuse the issue even more) (and both are quad core not dual core) – Jaromanda X Jul 31 '19 at 23:09
12

The Raspberry Pi 3 and 4 have 64-bit CPUs. However, Raspbian is a 32-bit operating system, so that SD card images work on all Pi models. Depending on where you're looking, the Pi will report armv6 or armv7 (usually armv7) although it's actually running in armv6 userland, and despite the hardware is actually armv8. Some other operating systems provide 64-bit images but they're less common.

ben_nuttall
  • 2,451
  • 12
  • 15
  • Can you please explain the difference between your answer and the answer from @goldilocks? – Ingo Jul 31 '19 at 19:32
  • 7
    That answer is right too but it focuses on docker. I'm just talking about the hardware and the Raspbian OS. Like they said, you can't run 64-bit applications on a 32-bit kernel. You have to either move to a 64-bit OS or use another database. – ben_nuttall Aug 01 '19 at 10:59