Pls, don't close the issue if it hasn't been solved yet :)
I'm not a docker expert so please, if this is just a config error or something that I did wrong, create a piece of documentation of how to use it properly inside docker. Thanks!
FROM golang:1.8.7-alpine3.6
RUN mkdir /app
WORKDIR /app
COPY main.go /app
# get git
RUN apk update
RUN apk add git
# This here breaks
RUN go get -u github.com/go-redis/redis
RUN go build -o main .
CMD ["./main"]
docker-compose build <name>)
You need to use Go modules that are available from v1.11 and import github.com/go-redis/redis/v7.
For anyone having the same problems (and cannot switch to go modules) put this in your dockerfile...
FROM golang:1.8.7-alpine3.6
RUN apk update
RUN apk add git
WORKDIR /go/src/github.com/go-redis/redis/
RUN git clone https://github.com/go-redis/redis.git .
RUN git checkout v6
WORKDIR /app
COPY main.go /app
RUN go build main.go
CMD ["./main"]
Most helpful comment
For anyone having the same problems (and cannot switch to go modules) put this in your dockerfile...