#proxy.golang.org 403 forbidden running docker build on a Hetzner server in Germany

25 messages · Page 1 of 1 (latest)

tall crow
#

Hi, I am trying to deploy my go dockerized application onto a Hetzner Docker CE which is based in Germany.

Unfortunately it seems that the proxy.golang.org is rejecting my access to downloading a certain package.

err: #9 3.349 /go/pkg/mod/github.com/valyala/[email protected]/compress.go:10:2: github.com/klauspost/[email protected]: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.16.4.zip: 403 Forbidden
err: #9 3.349 /go/pkg/mod/github.com/valyala/[email protected]/compress.go:11:2: github.com/klauspost/[email protected]: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.16.4.zip: 403 Forbidden
err: #9 3.349 /go/pkg/mod/github.com/valyala/[email protected]/compress.go:12:2: github.com/klauspost/[email protected]: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.16.4.zip: 403 Forbidden
err: #9 3.349 /go/pkg/mod/go.mongodb.org/[email protected]/x/mongo/driver/compression.go:17:2: github.com/klauspost/[email protected]: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.16.4.zip: 403 Forbidden
err: #9 ERROR: process "/bin/sh -c go build -o app main.go" did not complete successfully: exit code: 1

I've already tried to use direct oder any other proxy for env GOPROXY= X but it still tells me that same error with the same address.

I am using golang:1.21.0-alpine3.17 any advise will be highly appreciated.

Kind regards

#

Sidenote: the same container does work locally.

timid canyon
#

if you want to be nice you run your own caching proxy which is used by all dockers, it will likely make your builds faster

tall crow
tall crow
timid canyon
tall crow
timid canyon
#

@tall crow or:

FROM golang:1.21.0-alpine3.17

WORKDIR /app


COPY . .

ENV GOPROXY="direct"
RUN go mod download 
RUN go build -o app main.go

EXPOSE 3001

CMD ["./app"]
#

also btw you should go mod download with only go.mod

#
FROM golang:1.21.0-alpine3.17

WORKDIR /app

COPY go.mod go.sum .

ENV GOPROXY="direct"
RUN go mod download 
COPY . .
RUN go build -o app main.go

EXPOSE 3001

CMD ["./app"]
``` this allows for better caching because the dependencies are cached in their own docker FS layer
tall crow
timid canyon
#

idk

tall crow
#

wait I know the issue

#

nvm

#

the server did not pull the latest repository for some reason

timid canyon
#

caching

tall crow
#

I cann replace them and get them directly from github or is there more convinient solution?

timid canyon
#

I think you best bet is to open an issue on golang/go and explain that the websites are filtering hetzner traffic

#

I know multiple orgs that accidently banned all of the hetzner's IPs due to some spam traffic received

tall crow
#

yeah you seem right