Home > Backend Development > Golang > Why Doesn't My Go Binary Run on Alpine Linux Despite Docker's Go Binary Working?

Why Doesn't My Go Binary Run on Alpine Linux Despite Docker's Go Binary Working?

Linda Hamilton
Release: 2024-12-13 18:58:10
Original
432 people have browsed it

Why Doesn't My Go Binary Run on Alpine Linux Despite Docker's Go Binary Working?

Docker Go Binary Found But Other Go Binary Not Found in Path on Alpine Linux

This issue arises when trying to run a Go binary on an Alpine Docker image other than the Docker Go binary. The installed binary is not recognized by the system.

Problem Origin:

The problem lies in the lack of compatibility between the installed Go binary and the underlying musl-based Alpine Linux. Musl is a lightweight C library different from the glibc commonly used in other Linux distributions.

Solution:

To resolve this issue, create a symbolic link between /lib/libc.musl-x86_64.so.1 and /lib64/ld-linux-x86-64.so.2:

RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86_64.so.2
Copy after login

This symlink ensures compatibility between the installed Go binary and the musl library, enabling the binary to be recognized and executed as expected.

The above is the detailed content of Why Doesn't My Go Binary Run on Alpine Linux Despite Docker's Go Binary Working?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template