Home > Backend Development > Golang > Why Isn't My Go Binary Found in the PATH Despite Successful Installation in a Dockerized Alpine Linux Environment?

Why Isn't My Go Binary Found in the PATH Despite Successful Installation in a Dockerized Alpine Linux Environment?

Linda Hamilton
Release: 2024-12-02 10:15:11
Original
890 people have browsed it

Why Isn't My Go Binary Found in the PATH Despite Successful Installation in a Dockerized Alpine Linux Environment?

Docker Issue: Installed Go Binary Not Found in Path on Alpine Linux

In a Docker environment using Alpine Linux, an attempt to run a non-Docker Go binary results in the error message "not found." The binary is installed in /usr/local/bin/, and its path is included in the system's PATH variable.

This issue is encountered despite the successful installation and execution of the Docker Go binary. Both binaries are installed using curl and chmod commands.

Possible Solution

The error suggests that the binary is not being recognized by the system because it is missing a library dependency. To resolve this, the following command can be added to the Dockerfile before installing the Go binary:

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

This command creates a symbolic link between the musl and glibc libraries, making the necessary dependency available to the Go binary.

The above is the detailed content of Why Isn't My Go Binary Found in the PATH Despite Successful Installation in a Dockerized Alpine Linux Environment?. For more information, please follow other related articles on the PHP Chinese website!

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