1

I am trying to add a Golang script to my REST API and I am facing a problem of compatibility between my Golang executable and the Docker my docker container. Let me give you some context:

This is what the Docker is using to run, is on Alpine: FROM node:16.14.2-alpine3.15 AS development

I had the error yesterday that the Alpine did not find the executable not either specifing the path of the libtary as $PATH.

I searched and people got it solved installing libc6-compat on the Docker Container, for me it did no solve, now it does find the executable.

But it seems due to the version of C where the Go program was built now it has a compaibility problem with my C Library on the Docker, I will share the versions of each with the issued I am facing:

Docker doing ldd /lib/libc.so.6: /lib/ld-musl-x86_64.so.1 (0x7f0bf7710000)

Executable doing ldd ./<execName>:

 /lib/ld-musl-x86_64.so.1 (0x7f0bf7710000)
/api/src/smart-contract/initialBlock # ldd ./getBlock
        /lib64/ld-linux-x86-64.so.2 (0x7f7496e19000)
Error loading shared library libresolv.so.2: No such file or directory (needed by ./getBlock)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f7496e19000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f7496e19000)
Error relocating ./getBlock: __vfprintf_chk: symbol not found
Error relocating ./getBlock: __res_search: symbol not found
Error relocating ./getBlock: __fprintf_chk: symbol not found

I do not know much about Golang, I just needed to implement one script, I would love to get some guidance on how could I solve this issue, can I just compile the executable on another version?

I understand that if I update the C Library on my Docker I could have more compatibility issues with the code I already have on the API, so I would love to hear a least invasive way of doing it.

Thank you very much. I will be waiting for some answers!

Have a good weekend!

I installed an apk for solving compatibility issues but now I got other issues

Marxian
  • 19
  • 2
  • This seems fundamentally similar to [Go-compiled binary won't run in an alpine docker container on Ubuntu host](https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host); do the answers there help? Possibly the easiest fix is to just not use Alpine here, but maybe the Debian-based `node:...-buster-slim` image. – David Maze Mar 31 '23 at 10:59

0 Answers0