Im having some trouble getting the arm64 docker image to run properly. When attempting to start the container I get the following error:
“exec ./Universal/Universal.Server: exec format error”
Here is some information about my environment:
k3s variant of Kubernetes
four nodes, all four are raspberry pi model 4’s, 3 with 8gb of ram, 1 with 4gb
I also tested running the amd64 image in the same environment by adding an amd64 node which I have since removed. When testing on amd64 the container starts flawlessly.
Im still a bit new to using kubernetes so its possible its a problem with my setup and Im just doing something stupid
Yep looks like the first image failed to start at all with the following error:
exec /usr/bin/pwsh-preview: exec format error
The second image appears to have started, opened powershell and then exited which I assume is the normal behavior if you just pull and run this image. Here is what I see in the logs for the second image:
I suspect you have no emulation layer allowing the arm64 device to use amd64 images.
The images I gave you were Microsoft provided Ubuntu images with PowerShell installed.
Image 1 is what @adam uses to build PowerShell on top of.
Image 2 is a similar image build with Kubernetes in mind to run on the arm64 architecture.
Where arm64 is not new, we are beginning to see it more and more in the data centre to drastically reduce cost. Microsoft do not seam to use multi arch build images, which present complexities.
Hmm I might just try building my own image then. I didn’t realize cross architecture emulation was a thing for containers, now that I’ve looked into it it looks cool and its nice to know its an option but I would prefer to avoid emulation so resources are not wasted on the overhead from emulation.
I’ve run the arm64 zip package for PSU on my Pi’s in the past and it worked great so theoretically all I should need to do is make an image with the zip installer, pwsh 7 and ubuntu for arm64 as the parent image
2. Install Powershell-Core matching the version of the PSU image you are trying to rebuild.
3. Replicate the build script in this forum post: Docker image not working - #39 by adam
4. use ‘docker buildx’ over ‘docker build’ to build your container.
If that all works as expected, that should give you a Multi arch container you can use on most devices.