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

时间:2018-05-16 12:53:30

标签: 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

2 个答案:

答案 0 :(得分:3)

由于错误代码为1或127或任何不是非常自我解释,处理此类问题的常用方法是注意最后一层成功构建

Step 5/10 : RUN go get github.com/codegangsta/gin ---> Running in aae1a6e5d8bc ---> e808aee68694 Removing intermediate container aae1a6e5d8bc Step 6/10

这里是

e808aee68694

所以你启动

docker run -it e808aee68694 bash

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

go-wrapper download # "go get -d -v ./..."

答案 1 :(得分:0)

问题是github.com/tidwall/tile38/client应该是github.com/tidwall/tile38/pkg/client

现在解决了

@Albin感谢你指出。