Go Installation on Alpine Linux
Installing Go in an Alpine Linux Docker container can be challenging due to differences in the system structure compared to other Linux distributions. One common issue is that the downloaded Go binary may not be found when attempting to run commands.
Problem:
As described in the provided context, the user had issues installing Go in an Alpine Docker image and encountered the error "sh: go: not found" when running the "go version" command. The steps taken to install Go included downloading the tar file, untarring it, and modifying the PATH environment variable to include the Go binary's location.
Solution:
The suggested solution involved using multi-stage builds to copy the Go installation from a pre-built Golang Docker image. Here's a breakdown of the provided solution:
FROM XXX COPY --from=golang:1.13-alpine /usr/local/go/ /usr/local/go/ ENV PATH="/usr/local/go/bin:${PATH}"
In this solution:
The above is the detailed content of Why is 'go: not found' an Error When Installing Go on Alpine Linux?. For more information, please follow other related articles on the PHP Chinese website!