Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not push/analyze images with tag #110

Open
deshui123 opened this issue Feb 5, 2018 · 5 comments · May be fixed by #111
Open

Can not push/analyze images with tag #110

deshui123 opened this issue Feb 5, 2018 · 5 comments · May be fixed by #111

Comments

@deshui123
Copy link

deshui123 commented Feb 5, 2018

@jgsqware @jzelinskie
I can not push local images with tag, even the tag is latest.

[root@clair-1 ~/clair/clairctl-master]$ docker-compose exec clairctl clairctl push -l docker.io/registry:2.5.1 --log-level Debug
2018-02-05 08:34:06.862922 D | config: Using config file: /home/clairctl/clairctl.yml
2018-02-05 08:34:06.863115 I | config: retrieving interface for local IP
2018-02-05 08:34:06.863124 D | config: interface provided, looking for eth0
2018-02-05 08:34:06.863387 D | server: Update local server port from "0" to "45399"
2018-02-05 08:34:06.863400 I | server: Starting Server on 172.18.0.4:45399
2018-02-05 08:34:06.868583 D | dockercli: docker image to save: registry:2.5.1
2018-02-05 08:34:06.868595 D | dockercli: saving in: /tmp/clairctl/registry/blobs
2018-02-05 08:34:09.506264 I | config: retrieving interface for local IP
2018-02-05 08:34:09.506286 D | config: interface provided, looking for eth0
2018-02-05 08:34:09.506441 I | clair: using http://172.18.0.4:45399/local as local url
2018-02-05 08:34:09.506454 I | clair: Pushing Layer 1/5 [aa9d9d620aa9]
2018-02-05 08:34:09.506577 D | clair: Saving aa9d9d620aa919ec1eed39cfe8a9d925c8185a15ec16a3ff17a609dfd81d8030[https://registry-1.docker.io/v2]
2018-02-05 08:34:09.547085 I | clair: adding layer 1/5 [aa9d9d620aa9]: receiving http error: 400
client quit unexpectedly
2018-02-05 08:34:09.547108 C | cmd: pushing image "registry:2.5.1": receiving http error: 400

We can see that dockercli save image to the path /tmp/clairctl/registry/blobs
While from the clairctl logs, we can see that it will check path docker.io/library/registry/blobs

{"Event":"processing layer","Level":"debug","Location":"worker.go:73","Time":"2018-02-05 08:34:09.543307","engine version":3,"format":"Docker","layer":"aa9d9d620aa919ec1eed39cfe8a9d925c8185a15ec16a3ff17a609dfd81d8030","parent layer":"","path":"**http://172.18.0.4:45399/local/docker.io/library/registry/blobs**/aa9d9d620aa919ec1eed39cfe8a9d925c8185a15ec16a3ff17a609dfd81d8030/layer.tar"}
{"Event":"could not download layer: expected 2XX","Level":"warning","Location":"driver.go:135","Time":"2018-02-05 08:34:09.545893","status code":404}
{"Event":"failed to extract data from path","Level":"error","Location":"worker.go:122","Time":"2018-02-05 08:34:09.546014","error":"could not find layer","layer":"aa9d9d620aa919ec1eed39cfe8a9d925c8185a15ec16a3ff17a609dfd81d8030","path":"http://172.18.0.4:45399/local/docker.io/library/registry/blobs/aa9d9d620aa919ec1eed39cfe8a9d925c8185a15ec16a3ff17a609dfd81d8030/layer.tar"}
{"Event":"Handled HTTP request","Level":"info","Location":"router.go:57","Time":"2018-02-05 08:34:09.546877","elapsed time":3645575,"method":"POST","remote addr":"172.18.0.4:41312","request uri":"/v1/layers","status":"400"}


If i push image without tag, it will push successfully.
If i push image with gcr.io and with tag, such as gcr.io/google-containers/etcd-amd64:3.0.17 , it also push successfully.

I found that push image with tag, the path will be http://172.18.0.4:34694/local/docker.io/library/redis/blobs/*******
While push image without tag, the path will be http://172.18.0.4:39827/local//redis/blobs/******
Could you please help to explain the logical and how to fix this issue?

@jdel
Copy link
Collaborator

jdel commented Feb 8, 2018

Hello, thanks for reporting this. There is a known bug (cannot remember which issue is already opened for this) in the URL parsing.

I meant to work on this but I've had no time at all.

@lukeb2e
Copy link

lukeb2e commented Mar 7, 2018

Hello,

is there any update on this issue?

From my limited understanding of the issue the problem seems to be in:

func save(imageName string) (distribution.Manifest, error) {
path := config.TmpLocal() + "/" + strings.Split(imageName, ":")[0] + "/blobs"

It should save the image like this: ${tempdir}/docker.io/library/ubuntu/
It does save the image instead like this: ${tempdir}/ubuntu/
For custom registries it does it correctly: ${tempdir}/registry.internal/namespace/name/

I also tried to use the full name of the image, but this does not fix the issue: clairctl --log-level debug push -l docker.io/library/ubuntu:14.04

@jgsqware jgsqware linked a pull request Mar 7, 2018 that will close this issue
@jgsqware
Copy link
Owner

jgsqware commented Mar 7, 2018

Can you try with this branch? https://github.com/jgsqware/clairctl/tree/fix-temp-path

@lukeb2e
Copy link

lukeb2e commented Mar 8, 2018

You remove the dots which should still be there and you append the tag which is not needed.

Image is saved in ${tempdir}/docker_io/library/ubuntu/14_04/blobs/, but is expected in http://127.0.0.1:40769/local/docker.io/library/ubuntu/blobs/.

I edited your tempImagePath: https://github.com/glookie1/clairctl/tree/fix-temp-path

This is tested with the ubuntu:14.04 image and works now.

This was referenced Mar 8, 2018
@cchung100m
Copy link

Hi @jgsqware

I encounter the same issue from master branch.
Would you consider merge the fix to master and update the installation to S3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants