0

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
/go
/ #
/ # echo $PATH
/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

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.

David Maze
  • 130,717
  • 29
  • 175
  • 215
kozmo
  • 4,024
  • 3
  • 30
  • 48
  • 2
    I have no knowledge of DinD, but would it not be easier to use the GoLang official images instead? --> https://hub.docker.com/_/golang – JustLudo Jul 24 '20 at 07:39

1 Answers1

2

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

output

Step 3/3 : RUN go version
 ---> Running in 123401c3ebad
go version go1.12.12 linux/amd64
Adiii
  • 54,482
  • 7
  • 145
  • 148