'/bin/sh: go: not found' in 'docker:dind' container


I try to install Golang (go1.13.9.linux-amd64) in docker-in-docker container(docker:dind) manually (copy go binaries to a container).

Go was copied to /go/bin,

/ # export GOROOT=/go
/ # export PATH=$GOROOT/bin:$PATH
/ # 
/ # uname -a
Linux 41868f6e7ae3 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 Linux
/ #
/ # echo $GOROOT
/ #
/ # echo $PATH

I try check version and get an error:

/ # go version
/bin/sh: go: not found

I try add env to /etc/profile 👉🏻 the same error.


You did not mention the base image, but better to use on the of the base image either for go or docker-dind, I will recommend dind that is base on alpine and then install go.

FROM docker:dind
RUN apk add --no-cache go
RUN go version


Step 3/3 : RUN go version
 ---> Running in 123401c3ebad
go version go1.12.12 linux/amd64

Answered By – Adiii

Answer Checked By – Terry (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.