我有一個簡單的應(yīng)用程序,用于github.com/go-sql-driver/mysql連接到 MySQL 數(shù)據(jù)庫并執(zhí)行簡單的查詢。這一切在我的本地機器上運行良好,但是當(dāng)我嘗試使用 docker build 構(gòu)建它時,我得到以下輸出:[+] Building 4.1s (9/10) => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 104B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/golang:onbuild 1.3s => [auth] library/golang:pull token for registry-1.docker.io 0.0s => [internal] load build context 0.0s => => transferring context: 5.63kB 0.0s => CACHED [1/2] FROM docker.io/library/golang:onbuild@sha256:c0ec19d49014d604e4f62266afd490016b11ceec103f0b7ef44 0.0s => [2/2] COPY . /go/src/app 0.1s => [3/2] RUN go-wrapper download 2.0s => ERROR [4/2] RUN go-wrapper install 0.6s------我的 go 版本是最新的,我正在使用以下 dockerfile:FROM golang:onbuild據(jù)我所知,這應(yīng)該go get是它需要的所有包。我也試過這樣:FROM golang:onbuildRUN go get "github.com/go-sql-driver/mysql"這具有相同的輸出。請注意,在我的代碼中,我像這樣導(dǎo)入包:import _ "github.com/go-sql-driver/mysql"我還使用了 github 上的其他包,這些似乎工作正常。
使用 mysql 驅(qū)動程序時嘗試在 docker 中構(gòu)建我的 golang 應(yīng)用程序時出錯
阿波羅的戰(zhàn)車
2022-12-05 17:12:15