我的文件FROM golang:1.10.2-alpine3.7 AS buildRUN apk --no-cache add gcc g++ make ca-certificatesRUN apk add gitWORKDIR /go/src/github.com/meowerCOPY Gopkg.lock Gopkg.toml ./COPY util utilCOPY event eventCOPY db dbCOPY search searchCOPY schema schemaCOPY meow-service meow-serviceCOPY query-service query-serviceCOPY pusher-service pusher-serviceRUN go get -d -v ./...RUN go install ./...FROM alpine:3.7WORKDIR /usr/binCOPY --from=build /go/bin .我添加了 apk add git line.Without 這條線我的 docker-compose up 產生了Step 13/17 : RUN go get -d -v ./... ---> Running in d917adba00cdgithub.com/lib/pq (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/lib/pq: exec: "git": executable file not found in $PATHgithub.com/nats-io/go-nats (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/nats-io/go-nats: exec: "git": executable file not found in $PATHgithub.com/gorilla/mux (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/gorilla/mux: exec: "git": executable file not found in $PATHgithub.com/kelseyhightower/envconfig (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/kelseyhightower/envconfig: exec: "git": executable file not found in $PATHpackage github.com/retry: invalid github.com/ import path "github.com/retry"github.com/segmentio/ksuid (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/segmentio/ksuid: exec: "git": executable file not found in $PATHgithub.com/gorilla/websocket (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/gorilla/websocket: exec: "git": executable file not found in $PATHgithub.com/olivere/elastic (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/olivere/elastic: exec: "git": executable file not found in $PATH這是什么意思?
1 回答

MMMHUHU
TA貢獻1834條經驗 獲得超8個贊
go get
在內部調用用于托管要獲取的包的特定 VCS 的“參考”客戶端工具。換句話說,go get
它本身不知道如何與 VCS 服務器交互。
所以是的,為了go get
一個由 Git 托管的包,您需要提供可調用git
二進制文件的工作 Git 安裝。
至于你的第二個問題,它似乎與 Go 沒有任何關系,所以我建議你做一些研究,然后問一個單獨的問題,alpine
如果失敗的話。
- 1 回答
- 0 關注
- 179 瀏覽
添加回答
舉報
0/150
提交
取消