相关文章推荐
深沉的领结  ·  refused to execute ...·  1 年前    · 
无邪的海豚  ·  mysql galera ...·  1 年前    · 
心软的蘑菇  ·  [软件] ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

This seems fundamentally similar to Go-compiled binary won't 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 at 10:59

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.