Closed umanam closed 6 years ago
have you built klar
binary before building the docker image?
Yes, I did go build then tried docker run.
@umanam Thanks for your report. I can reproduce this error, will try to fix it.
The image is built from scratch
, maybe some file needed by klar
is missing. Replace base image scratch
with centos:7
, there is no problem.
tried to get the klar file directly and it worked, without docker image. But it covers global images, not local registry images. I get this error. Analyse image https://reg.starfleet.w3-969.ibm.com/v2/waas-consul-acl-v2/consul:1.0.392 failed: Analyze error 404: {“Error”:{“Message”:“the resource cannot be found”}}
I do have an image name reg.starfleet.w3-969.ibm.com/reg.starfleet.w3-969.ibm.com with version 1.0.392. But its not processing it and failing with above error
I've tried to reproduce it on my Mac:
$ GOOS=linux go build -o klar .
$ docker build -t klar:scratch .
$ docker run klar:scratch
Clair address must be provided
everything works as expected with scratch
image /cc @supereagle
What's your docker version?
Docker version in my Env:
ocker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:31:53 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:51:55 2017
OS/Arch: linux/amd64
Experimental: true
$ docker version
Client:
Version: 17.06.1-ce
API version: 1.30
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:53:38 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:54:55 2017
OS/Arch: linux/amd64
Experimental: true```
@hashmap I really reproduced it on my Mac before, but now can not reproduce in the same environment. So I find another new environment, but this error still can be reproduced. It is a little strange, I am not sure the root cause.
Maybe you already have CGO_ENABLED=0
set in your environment variables, @hashmap ?
Full command to build klar is: CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o klar .
This is also wrong in the README.
Double checked, no Go-specific vars except GOPATH
. It could be the case if you compile on Linux, because cgo is disabled automatically when cross compiling, but @supereagle was also on Mac and you specified GOOS=linux
, so I'm assuming cross compiling too.
Ah, interesting. Probably different go versions then? (I believe they changed some defaults around v1.5)
My theory seems to have been wrong: cross compiles are apparently always static by default. https://github.com/golang/go/issues/14906 (see second post by Dave Cheney)
Is it solved by https://github.com/optiopay/klar/pull/58 ?
Docker run on klar is failing. The docker file content : FROM scratch
ENV DOMAIN=skydns.local ENV RELEASE 0.1
Required by golang's time pkg
ENV ZONE_INFO /zoneinfo.zip COPY assets/zoneinfo.zip /
Required for SSL
COPY assets/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
COPY klar /
ENTRYPOINT ["/klar"] CMD [""]
=======
and output for this is:- docker run --env-file=my-klar.env klar postgres:9.5.1 standard_init_linux.go:178: exec user process caused "no such file or directory"