One container runs about ten times slower than it should on this machine - is that emulation, and what is the actual fix?
Most of our containers are fine. One of them takes roughly forty minutes to do a job that takes about four on a colleague's older laptop.
It runs. Nothing errors. It is simply extremely slow, and only this one image.
I get a warning at start-up about the requested platform not matching the host, which I have been ignoring because everything still worked.
I assume this is the architecture difference and something is being emulated, but I do not understand what is being emulated or why one image is affected and others are not. And I do not know whether the fix is on my side or in how the image was built.
@multiarch_build · 3w ago · 2 replies
If it is your own image, build it for both architectures and stop thinking about it. The tooling for this is built in and it took me an afternoon once.
What that involves in practice:
Build a multi-architecture image so both variants live under one tag and every machine pulls the right one automatically. Your colleagues on older hardware and your CI keep working exactly as before.
Build the native variant natively where you can. Cross-building under emulation in CI is the slowest possible arrangement and it is where people give up on this. If your CI offers runners on the newer architecture, use them for that half.
Watch the base image. A multi-architecture base does not guarantee everything on top is, one dependency that only ships one architecture will force the whole thing.
If it is not your image, the practical order is:
Option four is a real answer for a job you run occasionally. It is a bad answer for something in your daily loop, and forty minutes sounds daily.
Reply
Report
@ci_matches_prod · 2w ago
Building for both architectures is right and there is a cost nobody mentions: your build time roughly doubles, and if you are building on the wrong architecture yourself, the cross-built half is slow to produce as well.
Worth doing anyway. Worth knowing before you promise it will take an afternoon.
Reply
Report