Docker GO build returned a non-zero code: 1

2019-08-16 18:17发布

Docker command to build

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

标签: docker go
2条回答
老娘就宠你
2楼-- · 2019-08-16 18:19

Issue was github.com/tidwall/tile38/client should be github.com/tidwall/tile38/pkg/client

Now its resolved

@Albin thanks for point it out.

查看更多
孤傲高冷的网名
3楼-- · 2019-08-16 18:22

As an error code of 1 or 127 or any is not very self explanatory, the usual way of dealing with this type of problem is to notice the last layer successfully built

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

here it is

e808aee68694

so you launch

docker run -it e808aee68694 bash

and now you launch the last failing command, and it should be more clear why it fails

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

查看更多
登录 后发表回答