clairctl icon indicating copy to clipboard operation
clairctl copied to clipboard

Fix Layer paths for local repos

Open leopoldodonnell opened this issue 7 years ago • 5 comments

The current implementation of the layer push code replaces the repository endpoint with the local IP. This works great for images that are being pulled from docker hub or have no repository component to their tags. It fails when the image is local, but there is a registry endpoint. If the remote registry model worked in all cases, this change would not be necessary. For the time being, it appears that clairctl doesn't work with ECR credentials, so the --local route is necessary.

leopoldodonnell avatar Apr 21 '17 00:04 leopoldodonnell

Thanks for your contribution.

For the credential problem, Clairctl use the docker login command to log into the registry. So have you logged you before with docker login?

jgsqware avatar Apr 25 '17 14:04 jgsqware

hm. since I still struggle with the same problem (analysing images from a private repo) I tried this patch too. not working for me ... @leopoldodonnell did you miss to include another change?

with

clairctl analyze --local <registry>/image:0.0.2-rc1-3 --log-level debug
2017-05-11 12:21:15.690227 D | config: interface provided, looking for eth0
2017-05-11 12:21:15.690556 I | clair: using http://10.61.61.23:0/local as local url
2017-05-11 12:21:15.697890 D | server: Update local server port from "0" to "52595"
2017-05-11 12:21:15.698220 I | server: Starting Server on 10.61.61.23:52595

but

2017-05-11 12:21:16.008731 W | detectors: could not download layer: Get http://10.61.61.23:0/local/<id>/layer.tar: dial tcp 10.61.61.23:0: getsockopt: connection refused
2017-05-11 12:21:16.010554 E | worker: layer 7563c5fe78c2cd1cb9c58b3333df4cb1cd5764fb81b22bdab673767b0aedb82a:

port 0 is definitely not the one we want to request something from

ehaselwanter avatar May 11 '17 12:05 ehaselwanter

The server ip is in fact not correct, I will fix this PR.

jgsqware avatar May 11 '17 13:05 jgsqware

@leopoldodonnell here is a patch to apply to your PR, that should work,

fix_local_server_ip.patch.txt

jgsqware avatar May 11 '17 13:05 jgsqware

Reference #52

lcgkm avatar Jun 15 '17 05:06 lcgkm