Docker standard_init_linux.go Crash

I recently found myself running into a strange yet silly problem deploying some code I wrote. The code was Python running in a container on a Cradlepoint router. It worked well for my manual testing, but would immediately crash on the Cradlepoint. Cradlepoints use Docker Swam as their container orchestrator under the hood rather than Kubernetes, but this wasn’t really a problem given that the deployment was very simple and there weren’t many differences to figure out.

I’m no stranger to building containers that crash, but this one threw me for a loop because it wasn’t my code crashing. The container would crash immediately upon launch, and checking the logs showed that it was standard_init_linux.go that was having problems… not my code. The fact that it was the underpinnings of the container infrastructure gave me a pretty quick idea of what the issue was.

I do most of my development for work on a MacBook Pro with an M2 processor. When I build container images, though, they ultimately end up running in Kubernetes infrastructure running on normal 64-bit architecture rather than ARM. So I build containers with something like this to specify the target architecture:

docker build -t container-name:1.0.0 --platform=linux/amd64 .

I mindlessly used the same thing when building the container for a Cradlepoint. However, I had already even thought to check the architecture the Cradlepoint used (since it’s different based on device model) and knew I needed ARM v8… I just forgot about it. I gave the image a rebuild with:

docker build -t container-name:1.0.0 --platform=linux/arm/v8 .

After this, everything worked correctly.