Cannot install in Docker base image alpine (package crypto/ecdh is not in GOROOT)
cosad3s opened this issue ยท 5 comments
Works fine in Debian image.
FROM alpine:latest
RUN apk update && apk add go
RUN go install -v github.com/refraction-networking/utls@latest
Error:
/root/go/pkg/mod/github.com/refraction-networking/utls@v1.5.4/cfkem.go:25:2: package crypto/ecdh is not in GOROOT (/usr/lib/go/src/crypto/ecdh)
Encountered that error when installing https://github.com/projectdiscovery/subfinder into a custom alpine image.
May I know the purpose of go install
ing github.com/refraction-networking/utls
in the Dockerfile?
I just start an alpine distro with proot-distro
on termux with:
apk update
apk upgrade
apk add go
CGO_ENABLED=0 go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
~/go/bin/subfinder --version
and it seems to work fine.
Maybe there's no need to go install
this dependency explicitly. And please try go build
without CGO_ENABLED=0
and only add it back if things are broken.
Here's also Go's documentation on dependency-related commands: https://pkg.go.dev/cmd/go#hdr-Add_dependencies_to_current_module_and_install_them.
crypto/ecdh
is added in Go 1.20. And that is the reason why uTLS requires a minimal version of Go 1.20+.
You're right @gaukas , last version of Go installed from apk
for Alpine Linux is go version go1.19.9 linux/amd64
.
So I think this issue can be closed as the prerequisites are not meet.
Thanks @zedifen , but I still got an error in my environment root/go/pkg/mod/github.com/refraction-networking/utls@v1.5.2/cfkem.go:25:2: package crypto/ecdh is not in GOROOT (/usr/lib/go/src/crypto/ecdh)
. But anyway, I will get the last Go binary instead of the package from Alpine repository.
Glad the issue is solved! Just for everyone's information, I searched for alpine Docker image and saw this page https://hub.docker.com/_/alpine. Looks like the latest
alpine is 3.18.4
.
And it turns out that my alpine is on edge
branch of package repositories. I got Go 1.21.4 from there.
I also searched for go
in alpine package repositories site and it seems it has Go 1.20 on v3.18
branch, while it's Go 1.19 on v3.17
branch. By the way, they are all under community
repository.
Sorry that I'm not running Docker, so I'm not sure what's in your /etc/apk/repositories
. Please check it if you'd like. ๐