Score:0

Run a 32-bit binary on Google Cloud Run

ro flag

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.

Score:1
ro flag

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.

John Hanley avatar
cn flag
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.
kess avatar
ro flag
@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.
Jim Beveridge avatar
tn flag
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 avatar
tn flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.