0

The title say it all. I need a way to run a 32-bit binary on Cloud Run, which seems to only support 64-bit

What I'm looking for is some sort of emulator or compatibility layer that I could install.

I cannot compile the program to 64-bits.

kess
  • 121
  • 4

1 Answers1

2

I found the program I was looking for, which is qemu.

After you add apt install -y qemu-user to your Dockerfile you can run a 32-bit binary with the command qemu-i386 ./file

I hope one day someone comes across this question & answer and finds it useful.

kess
  • 121
  • 4
  • 1) Did you verify that this works in Cloud Run? 2) Your solution is interesting. QEMU is a well know program that has been around for a long time. I would like to see the Cloud Run Dockerfile that supports this with a real working example. That would make your answer useful in the future. – John Hanley Oct 30 '21 at 19:52
  • @JohnHanley 1) I did verify it. 2) I might update the anwser with a minimal example, but right now it is used in a complex closed-source program, so currently I cannot present that to you as an example. Altough I think that what I've provided is enough for someone to get started. – kess Oct 30 '21 at 20:45
  • I was able to make this work very well. The key lines from the Dockerfile are below. This uses Ubuntu, not Alpine. FROM python:3.10-slim dpkg --add-architecture i386 apt-get install -y --no-install-recommends libc6:i386 – Jim Beveridge Apr 02 '23 at 19:54
  • Correction - the key lines from the Dockerfile are below. You may need additional packages if you have a C++ app - this is for a C app. FROM ubuntu:18.04 dpkg --add-architecture i386 apt-get install -y --no-install-recommends qemu-user libc6:i386 Then, to run the 32-bit application: qemu-i386 /path/to/myapp – Jim Beveridge Apr 02 '23 at 20:13