ots icon indicating copy to clipboard operation
ots copied to clipboard

arm64 image on Docker

Open kentala opened this issue 1 year ago • 2 comments

On https://hub.docker.com/r/luzifer/ots/tags only amd64 builds are present.

Can you make other builds available via Docker Hub (specifically arm64)? Starting up the container on Raspberry Pi 5 results in a exec /usr/local/bin/ots: exec format error.

kentala avatar Jun 06 '24 09:06 kentala

The DockerHub image will not gain multi-arch capabilities as those images are subject to deletion.

Need to have a look how to add multi-arch capabilities to the GHCR image

Luzifer avatar Jun 06 '24 10:06 Luzifer

Please have a look at the latest develop image tag. It is displayed as having both amd64 as well as arm64 images. I can confirm the amd64 works… …if the arm64 does too we can apply that to the release images with the upcoming release.

~~The only thing is… …the baked-in versions do not work properly… …need to have a look at that.~~

Luzifer avatar Sep 22 '24 09:09 Luzifer

I tried getting this running on a pi. I'm getting exec format error from the container.

uname -a

Linux tp1n1 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux

Output

exec /usr/local/bin/ots: exec format error

image:

image: ghcr.io/luzifer/ots:develop@sha256:f47e7e92d92f8db0dd71faf7fbd7f497aaf3a16308d3dc4d66bf57728facfd06

jimmypw avatar Oct 25 '24 16:10 jimmypw

The amd64 binary is making it in to the arm image somehow. I've looked at your actions there's nothing i wouldn't do in there.

Picking apart ghcr.io/luzifer/ots:develop@sha256:f47e7e92d92f8db0dd71faf7fbd7f497aaf3a16308d3dc4d66bf57728facfd06 I see:

readelf -h ots 
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x4791a0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          400 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         6
  Size of section headers:           64 (bytes)
  Number of section headers:         23
  Section header string table index: 20

The busybox binary is -amd64- arm64 however

jimmypw avatar Oct 25 '24 16:10 jimmypw

Digging through the build log i found this

https://github.com/Luzifer/ots/actions/runs/11001132707/job/30545104419#step:7:319

Although the context is being run in arm64, x86_64 packages are being pulled by the build container.

jimmypw avatar Oct 25 '24 19:10 jimmypw

# docker export $(docker create ghcr.io/luzifer/ots:develop@sha256:f47e7e92d92f8db0dd71faf7fbd7f497aaf3a16308d3dc4d66bf57728facfd06) | tar -x
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested

# file usr/local/bin/ots
usr/local/bin/ots: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=UwFSHRU6UoivEga-ZpNm/rNldv0Jk3UEH6ph1pHqr/cR7-06xfRhgVDzyFCJdr/5_y0FZGube169U8c5m9A, with debug_info, not stripped

Hmm looks like the binary was build wrong… 🤔 …but how, and why and… …what?

Luzifer avatar Oct 25 '24 19:10 Luzifer

Although the context is being run in arm64, x86_64 packages are being pulled by the build container.

I'd say that explains my question :D

Luzifer avatar Oct 25 '24 19:10 Luzifer

The build container is archlinux, arch doesn't support ARM. that's why.

I see you're building off your own image so I won't submit a PR in this instance and build my own separate pipeline. Happy to pitch in if needed. I want to get this working in my setup, it's exactly what i need.

Sorry if you're getting spammed by these messages.

jimmypw avatar Oct 25 '24 19:10 jimmypw

Yeah need to change the build image to match the output image…

Luzifer avatar Oct 25 '24 19:10 Luzifer

If you're happy for the build image to change I'll put together a mr now ;)

jimmypw avatar Oct 25 '24 19:10 jimmypw

Yeah basically just change to golang:alpine, add node, bake everything and we're good…

Luzifer avatar Oct 25 '24 19:10 Luzifer

Can change that later today if you want…

Luzifer avatar Oct 25 '24 19:10 Luzifer

# docker export $(docker create ghcr.io/luzifer/ots:develop@sha256:064debe231181ba6a0a3df08f602cdad2fb67cb95216e88158bd8f9e741fabc2) | tar -x
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64/v4) and no specific platform was requested

# file usr/local/bin/ots
usr/local/bin/ots: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=IkJR4CRMarC7-OX09-eN/DivvDNI7ceotgLryKXu4/OcXR5cJYUoCkSEcJgCvM/-u6gnJgVCIzBYWsJTNYj, with debug_info, not stripped
# docker export $(docker create ghcr.io/luzifer/ots:develop@sha256:22aa8ba40d5710c14d669683d80758b1880c382ea0b5de2a3b7743a3e6849b74) | tar -x

# file usr/local/bin/ots
usr/local/bin/ots: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=sgR6G8xq7NW-Ua6lkn2G/R5Hj7cwHzcJzql4FAGdJ/EKM4_vc2dXSyu0XcccEz/ud23Zr2AsGMWowfo8v-z, with debug_info, not stripped

Nice. Those two look better. Please try again - and thanks for taking over the fix! 🙂

Luzifer avatar Oct 25 '24 22:10 Luzifer

My pleasure. Tested the develop tag on my infrastructure and it works great.

Thank you for the quick responses.

jimmypw avatar Oct 26 '24 05:10 jimmypw

That's great! Then we just need to get that milestone out… …need to see when I can make time for that… …hopefully soon.

Luzifer avatar Oct 26 '24 09:10 Luzifer