gliderlabs / registrator

Service registry bridge for Docker with pluggable adapters
http://gliderlabs.com/registrator
MIT License
4.66k stars 912 forks source link

Running into errors attempting to build on Windows #614

Open dky opened 6 years ago

dky commented 6 years ago

Hello all, I'm attempting to build registrator on Windows and currently getting the following build error. Any input at all would be helpful.

Server Version: 17.06.2-ee-8 - Running on Windows 2016 1607

Attempting to build from master/release which is v7.

Description of the problem:

Build for Windows isn't completing, stuck on some etcd error, here is my hobbled together Dockerfile.

FROM golang:1.10-windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY . /work/go/src/github.com/gliderlabs/registrator

RUN cd C:/work/go/src/github.com/gliderlabs/registrator; \
        $env:GOPATH='C:\work\go'; \
        git config --global http.https://gopkg.in.followRedirects true; \
        go get; \
        go build -ldflags '-X main.Version=v7' -o C:/registrator.exe; \
        cd c:/; \
        rm /work -Force -Recurse; \
        & C:/registrator.exe --version;

WORKDIR C:/

How reproducible: docker build . gives me the following error during build:

PS C:\Users\Administrator\git\registrator> docker build .
Sending build context to Docker daemon  103.9kB
Step 1/5 : FROM golang:1.10-windowsservercore
 ---> 8520b84033e1
Step 2/5 : SHELL powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';
 ---> Using cache
 ---> bcb291ebca85
Step 3/5 : COPY . /work/go/src/github.com/gliderlabs/registrator
 ---> aa024572bd3b
Removing intermediate container 890d313f4edb
Step 4/5 : RUN cd C:/work/go/src/github.com/gliderlabs/registrator;     $env:GOPATH='C:\work\go';       git config --global http.https://gopkg.in.followRedirects true;         go get;
go build -ldflags '-X main.Version=v7' -o C:/registrator.exe;   cd c:/;         rm /work -Force -Recurse;       & C:/registrator.exe --version;
 ---> Running in e9d78ce2ddd8
# github.com/coreos/go-etcd/etcd
..\..\coreos\go-etcd\etcd\response.generated.go:99:6: r.EncodeArrayStart undefined (type codec.genHelperEncDriver has no field or method EncodeArrayStart)
..\..\coreos\go-etcd\etcd\response.generated.go:107:6: r.EncodeMapStart undefined (type codec.genHelperEncDriver has no field or method EncodeMapStart)
..\..\coreos\go-etcd\etcd\response.generated.go:111:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:119:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:121:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:130:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:142:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:144:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:157:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:170:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:170:6: too many errors
# github.com/coreos/go-etcd/etcd
..\..\coreos\go-etcd\etcd\response.generated.go:99:6: r.EncodeArrayStart undefined (type codec.genHelperEncDriver has no field or method EncodeArrayStart)
..\..\coreos\go-etcd\etcd\response.generated.go:107:6: r.EncodeMapStart undefined (type codec.genHelperEncDriver has no field or method EncodeMapStart)
..\..\coreos\go-etcd\etcd\response.generated.go:111:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:119:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:121:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:130:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:142:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:144:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:157:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:170:6: z.EncSendContainerState undefined (type codec.genHelperEncoder has no field or method EncSendContainerState)
..\..\coreos\go-etcd\etcd\response.generated.go:170:6: too many errors
& : The term 'C:/registrator.exe' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:325
+ ... r.exe; cd c:/; rm /work -Force -Recurse; & C:/registrator.exe --versi ...
+                                                ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:/registrator.exe:String) [],
   ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; cd C:/work/go/src/github.com/gliderlabs/registrator;        $env:GOPATH='C:\wo
rk\go';         git config --global http.https://gopkg.in.followRedirects true;         go get;         go build -ldflags '-X main.Version=v7' -o C:/registrator.exe;   cd c:/;         rm
 /work -Force -Recurse;         & C:/registrator.exe --version;' returned a non-zero code: 1
dky commented 6 years ago

I'm not sure if this is an issue with registrator but more on the lines of the etcd imports. I commented out etcd imports since we only plan on using it with consul and was able to build successfully.