Home >Backend Development >Golang >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
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!