clairctl icon indicating copy to clipboard operation
clairctl copied to clipboard

Receiving http error: 404 in clairctl push image

Open ronakpandya7 opened this issue 7 years ago • 10 comments

Hello We are using clair with the latest tag image in kubernetes and it is working fine. We are using clairctl with version "1.17.1" on the other VM machine that will point to the clair that is running on the kubernetes. We are using GitLab as our repository. We have also done login for the gitlab repository successfully.

Connection of clairctl to the clair is working fine:

clairctl health --config docker-compose-data/clair-config/clair.yaml --log-level Debug 2017-11-13 14:30:42.462006 D | config: Using config file: docker-compose-data/clair-config/clair.yaml 2017-11-13 14:30:42.462267 D | clair: requesting health on: http://192.168.X.X:6061/health

Clair: ✔

clairctl pull is also working fine:

clairctl pull mygitlab.com/IMAGENAME:TAG --config docker-compose-data/clair-config/clair.yaml --log-level Debug

2017-11-13 14:34:15.648051 D | config: Using config file: docker-compose-data/clair-config/clair.yaml 2017-11-13 14:34:15.648603 D | dockerdist: Downloading manifest for mygitlab.com/IMAGENAME:TAG 2017-11-13 14:34:15.648877 D | dockerdist: Retrieving repository client 2017-11-13 14:34:16.077760 D | dockerdist: endpoint.TLSConfig.InsecureSkipVerify: true 2017-11-13 14:34:16.372053 D | dockerdist: manifest type: *schema2.DeserializedManifest 2017-11-13 14:34:16.372097 D | dockerdist: retrieved schema2 manifest, no verification

Image: mygitlab.com/IMAGENAME:TAG 14 layers found ➜ sha256:d93a2d7cc901177e87182b2003d50fb3ffd5be3eb698f39f5c862264efe6ee99 ➜ sha256:15a33158a1367c7c4103c89ae66e8f4fdec4ada6a39d4648cf254b32296d6668 ➜ sha256:f67323742a64d3540e24632f6d77dfb02e72301c00d1e9a3c28e0ef15478fff9 ➜ sha256:c4b45e832c38de44fbab83d5fcf9cbf66d069a51e6462d89ccc050051f25926d ➜ sha256:f83e14495c19e0bb1c7187b76571e3c6a2125dae2926678da165cfc6c7da0670 ➜ sha256:41fea39113bff896d196a20e0d032c7535e6a6239b3ce1d9c7749a092794c50e ➜ sha256:584aba53d32520b99da165bc759138850598dcaae16fe9a3d66fccd360051334 ➜ sha256:03a0247f80dcd7c592c8ae7aad57e90f10403f78f7d41aff9cd7c3780506a089 ➜ sha256:b65d8543ed8abe2c9c07ae804c9f64c2478e7c7723f9b3b8a4e126b7fab795ad ➜ sha256:ea683c7b9f47be1680217e25676459874f90827e5f0c5401e4b37b946c799adb ➜ sha256:65ff4d6c0638a71fadbc506030fb0c7c0726b04677631ccc6627db32b22956f1 ➜ sha256:704869da986f651b0ddc138af05355a69cd8d9528cdec6d502cbfac9e7ebf822 ➜ sha256:6a48148607f20f798e51681c6ed5c683734ecbd1c0dec665803682499688762b ➜ sha256:ed03ebaec38ff2cfa7c72c7e95d72a255abd61f2e9cb404f1af8305f74f257b0

But when I am trying to push that image into the clair it will throw the error:

CLAIRCTL LOG:

2017-11-13 14:34:45.880347 I | clair: adding layer 1/14 [sha256:d93a2]: receiving http error: 404 client quit unexpectedly 2017-11-13 14:34:45.880672 C | cmd: pushing image "mygitlab.com/IMAGENAME:TAG": receiving http error: 404

CLAIR LOG:

{"Event":"updating vulnerabilities","Level":"info","Location":"updater.go:191","Time":"2017-11-13 14:16:48.014472"} {"Event":"fetching vulnerability updates","Level":"info","Location":"updater.go:271","Time":"2017-11-13 14:16:48.014582"} {"Event":"Start fetching vulnerabilities","Level":"info","Location":"debian.go:63","Time":"2017-11-13 14:16:48.014654","package":"Debian"} {"Event":"Start fetching vulnerabilities","Level":"info","Location":"rhel.go:92","Time":"2017-11-13 14:16:48.014668","package":"RHEL"} {"Event":"Start fetching vulnerabilities","Level":"info","Location":"ubuntu.go:88","Time":"2017-11-13 14:16:48.014775","package":"Ubuntu"} {"Event":"Start fetching vulnerabilities","Level":"info","Location":"alpine.go:52","Time":"2017-11-13 14:16:48.014851","package":"Alpine"} {"Event":"Start fetching vulnerabilities","Level":"info","Location":"oracle.go:119","Time":"2017-11-13 14:16:48.014852","package":"Oracle Linux"} {"Event":"finished fetching","Level":"info","Location":"updater.go:290","Time":"2017-11-13 14:16:48.309124","updater name":"alpine"} {"Event":"finished fetching","Level":"info","Location":"updater.go:290","Time":"2017-11-13 14:16:49.022676","updater name":"rhel"} {"Event":"finished fetching","Level":"info","Location":"updater.go:290","Time":"2017-11-13 14:16:50.581985","updater name":"oracle"} {"Event":"finished fetching","Level":"info","Location":"updater.go:290","Time":"2017-11-13 14:17:02.669000","updater name":"ubuntu"} {"Event":"finished fetching","Level":"info","Location":"updater.go:290","Time":"2017-11-13 14:17:23.635493","updater name":"debian"} {"Event":"adding metadata to vulnerabilities","Level":"info","Location":"updater.go:317","Time":"2017-11-13 14:17:24.080494"} {"Event":"update finished","Level":"info","Location":"updater.go:256","Time":"2017-11-13 14:19:02.235155"} {"Event":"Handled HTTP request","Level":"info","Location":"server.go:105","Time":"2017-11-13 14:30:52.193693","elapsed time (ms)":0.09301999999999999,"method":"POST","remote addr":"192.168.X.X:53660","request uri":"/v1/layers","status":"404"} {"Event":"Handled HTTP request","Level":"info","Location":"server.go:105","Time":"2017-11-13 14:34:45.878425","elapsed time (ms)":0.025736,"method":"POST","remote addr":"192.168.X.X:53696","request uri":"/v1/layers","status":"404"}

Can somebody help me how can i solve this issue? Thanks

ronakpandya7 avatar Nov 13 '17 15:11 ronakpandya7

same error

debianmaster avatar Nov 19 '17 08:11 debianmaster

I see in the log this ":"POST","remote addr":"192.168.X.X:53660","request uri":"/v1/layers","status":"404"}

Probably Clair cannot access to your gitlab instance

jgsqware avatar Nov 19 '17 10:11 jgsqware

(comment removed, will raise as separate issue)

ninjaMog avatar Nov 23 '17 15:11 ninjaMog

+1

bigwolfdogroar avatar Feb 10 '18 01:02 bigwolfdogroar

I am facing similar issue while running clair locally on machine but while running clair in docker i am able to analyze image.

clair logs

{"Event":"Handled HTTP request","Level":"info","Location":"server.go:105","Time":"2018-02-28 17:34:21.819583","elapsed time (ms)":0.019098,"method":"POST","remote addr":"127.0.0.1:46923","request uri":"/v1/layers","status":"404"} {"Event":"Handled HTTP request","Level":"info","Location":"server.go:105","Time":"2018-02-28 17:38:49.726556","elapsed time (ms)":0.015087999999999999,"method":"POST","remote addr":"127.0.0.1:46933","request uri":"/v1/layers","status":"404"}

clairctl logs

2018-02-28 18:15:04.735406 D | config: Using config file: clairctl.yml 2018-02-28 18:15:04.735548 D | dockerdist: Downloading manifest for store/oracle/weblogic:12.2.1.3 2018-02-28 18:15:04.735639 D | dockerdist: Retrieving repository client 2018-02-28 18:15:30.798958 D | dockerdist: endpoint.TLSConfig.InsecureSkipVerify: true 2018-02-28 18:15:37.345113 D | dockerdist: manifest type: *schema2.DeserializedManifest 2018-02-28 18:15:37.345147 D | dockerdist: retrieved schema2 manifest, no verification 2018-02-28 18:15:37.345174 I | config: retrieving interface for local IP 2018-02-28 18:15:37.345187 D | config: no interface provided, looking for docker0 2018-02-28 18:15:37.346329 I | clair: Pushing Layer 1/7 [sha256:4040f] 2018-02-28 18:15:37.346467 D | clair: Saving sha256:4040fe120662cc1cc34732126b1e13bd38f0bb2f5b20a9a94e375dfda4fb1795[https://registry-1.docker.io/v2] 2018-02-28 18:15:37.346627 D | clair: auth.insecureSkipVerify: true 2018-02-28 18:15:37.346651 D | clair: request.URL.String(): https://registry-1.docker.io/v2/store/oracle/weblogic/blobs/sha256:4040fe120662cc1cc34732126b1e13bd38f0bb2f5b20a9a94e375dfda4fb1795 2018-02-28 18:15:38.783761 I | clair: pull from clair is unauthorized 2018-02-28 18:15:40.329867 I | clair: adding layer 1/7 [sha256:4040f]: receiving http error: 404 client quit unexpectedly 2018-02-28 18:15:40.329905 C | cmd: pushing image "store/oracle/weblogic:12.2.1.3": receiving http error: 404

Is any special configuration required if clair is run locally?

agnihotrigaurav avatar Feb 28 '18 13:02 agnihotrigaurav

Seems master branch is not stable. By checking out release-2.0 and then doing build worked for me.

agnihotrigaurav avatar Mar 01 '18 14:03 agnihotrigaurav

Hello everybody,

I have the same issue. From clair, who is on the same host of my registry, I can ping the registry. I'm using quay.io/coreos/clair-git in its latest version.

{"Event":"Handled HTTP request","Level":"info","Location":"server.go:105","Time":"2018-04-20 14:15:28.474904","elapsed time (ms)":0.008957,"method":"POST","remote addr":"172.17.0.1:37310","request uri":"/v1/layers","status":"404"}

From clairctl: jgsqware/clairct:latest

~ $ clairctl analyze registry.test.lan:5000/capfuzz:0 --log-level Debug 2018-04-20 14:15:03.413225 D | config: Using config file: /home/clairctl/clairctl.yml 2018-04-20 14:15:03.413325 D | dockerdist: Downloading manifest for registry.test.lan:5000/capfuzz:0 2018-04-20 14:15:03.413376 D | dockerdist: Retrieving repository client 2018-04-20 14:15:08.442878 D | dockerdist: endpoint.TLSConfig.InsecureSkipVerify: true 2018-04-20 14:15:21.897770 D | dockerdist: manifest type: *schema2.DeserializedManifest 2018-04-20 14:15:21.897787 D | dockerdist: retrieved schema2 manifest, no verification 2018-04-20 14:15:21.897801 I | config: retrieving interface for local IP 2018-04-20 14:15:21.897806 D | config: no interface provided, looking for docker0 2018-04-20 14:15:21.897876 D | config: docker0 not found, looking for first connected broadcast interface 2018-04-20 14:15:21.897995 I | clair: Pushing Layer 1/15 [sha256:c3b9c] 2018-04-20 14:15:24.510462 D | clair: Saving sha256:c3b9c0688e3b7308958fed66631654b5c981e097c88ef30a25ef9dd59074bc81[https://registry.test.lan:5000/v2] 2018-04-20 14:15:27.193691 D | clair: auth.insecureSkipVerify: true 2018-04-20 14:15:27.193711 D | clair: request.URL.String(): https://registry.test.lan:5000/v2/capfuzz/blobs/sha256:c3b9c0688e3b7308958fed66631654b5c981e097c88ef30a25ef9dd59074bc81 2018-04-20 14:15:28.475038 I | clair: adding layer 1/15 [sha256:c3b9c]: receiving http error: 404 client quit unexpectedly 2018-04-20 14:15:28.475059 C | cmd: pushing image "registry.test.lan:5000/capfuzz:0": receiving http error: 404

Any clue regarding this issue ? Thanks in advance, Best, Nicolas

nicocolt avatar Apr 20 '18 15:04 nicocolt

Hello,

Changing from clair-git to clair solved the issue.

Best, Nicolas

nicocolt avatar Apr 24 '18 08:04 nicocolt

You're using HEAD of git for Clair, which does not contain the Clair v2 API. I'm not sure if clairctl supports this new API as it is a tool built for Clair v2 and not Clair v3.

Please let me know if this isn't the case.

jzelinskie avatar Jun 25 '18 15:06 jzelinskie

So make sure to use quay.io/coreos/clair:latest instead of clair-git when starting up clair through docker.

icyerasor avatar Nov 18 '18 11:11 icyerasor