Docker GO 构建返回了一个非零代码 : 1

标签 docker go

构建Docker命令

sudo docker build -t gpst .


    ubuntu@ip-172-31-9-252:~/goyo/GO/goyo.in/gpstracker$ sudo docker build -t gpst .
    Sending build context to Docker daemon  1.819MB
    Step 1/10 : FROM golang:1.8
     ---> a8ef0d2260ca
    Step 2/10 : RUN mkdir -p /go/src/goyo.in/gpstracker
     ---> Using cache
     ---> 70f242e31c63
    Step 3/10 : WORKDIR /go/src/goyo.in/gpstracker
     ---> Using cache
     ---> a1609e2d1463
    Step 4/10 : COPY . /go/src/goyo.in/gpstracker
     ---> 2c90614f0f5b
    Step 5/10 : RUN go get github.com/codegangsta/gin
     ---> Running in aae1a6e5d8bc
     ---> e808aee68694
    Removing intermediate container aae1a6e5d8bc
    Step 6/10 : RUN go-wrapper download   # "go get -d -v ./..."
     ---> Running in 427b2c574de7
    + exec go get -v -d
    github.com/go-playground/log (download)
    github.com/go-playground/errors (download)
    github.com/tidwall/tile38 (download)
    package github.com/tidwall/tile38/client: cannot find package "github.com/tidwall/tile38/client" in any of:
            /usr/local/go/src/github.com/tidwall/tile38/client (from $GOROOT)
            /go/src/github.com/tidwall/tile38/client (from $GOPATH)
    github.com/garyburd/redigo (download)
    github.com/googollee/go-socket.io (download)
    github.com/googollee/go-engine.io (download)
    github.com/gorilla/websocket (download)
    github.com/rs/cors (download)
    github.com/jasonlvhit/gocron (download)
    github.com/NaySoftware/go-fcm (download)
    Fetching https://golang.org/x/net/context?go-get=1
    Parsing meta tags from https://golang.org/x/net/context?go-get=1 (status code 200)
    get "golang.org/x/net/context": found meta tag main.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/context?go-get=1
    get "golang.org/x/net/context": verifying non-authoritative meta tag
    Fetching https://golang.org/x/net?go-get=1
    Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
    golang.org/x/net (download)
    Fetching https://google.golang.org/grpc?go-get=1
    Parsing meta tags from https://google.golang.org/grpc?go-get=1 (status code 200)
    get "google.golang.org/grpc": found meta tag main.metaImport{Prefix:"google.golang.org/grpc", VCS:"git", RepoRoot:"https://github.com/grpc/grpc-go"} at https://google.golang.org/grpc?go-get=1
    google.golang.org/grpc (download)
    Fetching https://golang.org/x/text/secure/bidirule?go-get=1
    Parsing meta tags from https://golang.org/x/text/secure/bidirule?go-get=1 (status code 200)
    get "golang.org/x/text/secure/bidirule": found meta tag main.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/secure/bidirule?go-get=1
    get "golang.org/x/text/secure/bidirule": verifying non-authoritative meta tag
    Fetching https://golang.org/x/text?go-get=1
    Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
    golang.org/x/text (download)
    Fetching https://golang.org/x/text/unicode/bidi?go-get=1
    Parsing meta tags from https://golang.org/x/text/unicode/bidi?go-get=1 (status code 200)
    get "golang.org/x/text/unicode/bidi": found meta tag main.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/bidi?go-get=1
    get "golang.org/x/text/unicode/bidi": verifying non-authoritative meta tag
    Fetching https://golang.org/x/text/unicode/norm?go-get=1
    Parsing meta tags from https://golang.org/x/text/unicode/norm?go-get=1 (status code 200)
    get "golang.org/x/text/unicode/norm": found meta tag main.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/norm?go-get=1
    get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
    github.com/golang/protobuf (download)
    Fetching https://google.golang.org/genproto/googleapis/rpc/status?go-get=1
    Parsing meta tags from https://google.golang.org/genproto/googleapis/rpc/status?go-get=1 (status code 200)
    get "google.golang.org/genproto/googleapis/rpc/status": found meta tag main.metaImport{Prefix:"google.golang.org/genproto", VCS:"git", RepoRoot:"https://github.com/google/go-genproto"} at https://google.golang.org/genproto/googleapis/rpc/status?go-get=1
    get "google.golang.org/genproto/googleapis/rpc/status": verifying non-authoritative meta tag
    Fetching https://google.golang.org/genproto?go-get=1
    Parsing meta tags from https://google.golang.org/genproto?go-get=1 (status code 200)
    google.golang.org/genproto (download)
    The command '/bin/sh -c go-wrapper download   # "go get -d -v ./..."'     returned a non-zero code: 1

最佳答案

由于错误代码 1 或 127 或任何错误代码不是很容易解释,因此处理此类问题的通常方法是注意最后一层是否已成功构建

步骤 5/10:运行 go get github.com/codegangsta/gin ---> 在 aae1a6e5d8bc 中运行 ---> e808aee68694 删除中间容器 aae1a6e5d8bc 步骤 6/10

这里是

e808aee68694

所以你启动

docker run -it e808aee68694 bash

现在你启动了最后一个失败的命令,它应该更清楚失败的原因

go-wrapper 下载 # "go get -d -v ./..."

关于Docker GO 构建返回了一个非零代码 : 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50371508/

相关文章:

docker - 热重载无法在带有 golang 的 docker 中工作 (github.com/cosmtrek/air)

go - 主机参数在mux.Vars()中不可用

docker - 如何在 Docker 容器上配置环境变量而不将其硬编码到 Dockerfile 中?

Docker VS 代码移除 devcontainer

docker - 同步Docker主机图像与本地注册表

go - Golang 中的 Reader 是如何自动循环迭代的?

go - 如果文件夹名称与现有文件相同,则mkdir失败

go - Golang在函数中使用结构的全局变量中的设置变量

Docker 无法在入口点授予脚本权限

c# - Docker抛出异常,因为无法解析远程名称