1

我在当前的工作中使用 clair(env 是 nodejs)。当我通过 nodejs 模块“clair-client”向 /v1/layers 发送 POST 请求时。我收到一个错误“找不到图层”。该图像来自我的本地存储库,例如“ http://192.168.10.118:5000/ubuntu:16.04 ”。

PS:当我分析官方镜像“ubuntu:16.04”时,clair可以正常工作。在我成功分析图像“ubuntu:16.04”后,我还可以从本地存储库分析图像“ http://192.168.10.118:5000/ubuntu:16.04 ”。我的 postgres 发生了什么错误?我将展示一些有用的信息如下:

  • 我的本地存储库中的图像错误
{ Layer:
   { Name: '390582d83ead410e808a4d1868a5b1a329241132a76565fd69ab23f60c032d81e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     Path: 'https://192.168.10.118:5000/v2/ubuntu/blobs/sha256:e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     ParentName: '',
     Headers:
      { 'User-Agent': 'node-clair-docker/1.0.0',
        authorization: undefined },
     Format: 'Docker' } }

##response
{ ClairError: error uploading layers for image 'http://192.168.10.118:5000/ubuntu:14.04': 400 - {"Error":{"Message":"could not find layer"}}
  • 成功与官方形象
{ Layer:
   { Name: '390582d83ead410e808a4d1868a5b1a329241132a76565fd69ab23f60c032d81e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     Path: 'https://registry.hub.docker.com/v2/library/ubuntu/blobs/sha256:e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     ParentName: '',
     Headers:
      { 'User-Agent': 'node-clair-docker/1.0.0',
        authorization: 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlDK2pDQ0FwK2dBd0lCQWdJQkFEQUtCZ2dxaGtqT1BRUURBakJHTVVRd1FnWURWUVFERXpzeVYwNVpPbFZMUzFJNlJFMUVVanBTU1U5Rk9reEhOa0U2UTFWWVZEcE5SbFZNT2tZelNFVTZOVkF5VlRwTFNqTkdPa05CTmxrNlNr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pBREJHQWlFQXFOSXEwMFdZTmM5Z2tDZGdSUzRSWUhtNTRZcDBTa05Rd2lyMm5hSWtGd3dDSVFEMjlYdUl5TmpTa1cvWmpQaFlWWFB6QW9TNFVkRXNvUUhyUVZHMDd1N3ZsUT09Il19.eyJhY2Nlc3MiOlt7InR5cGUiOiJyZXBvc2l0b3J5IiwibmFtZSI6ImxpYnJhcnkvdWJ1bnR1IiwiYWN0aW9ucyI6WyJwdWxsIl19XSwiYXVkIjoicmVnaXN0cnkuZG9ja2VyLmlvIiwiZXhwIjoxNTU1NDcwOTQ4LCJpYXQiOjE1NTU0NzA2NDgsImlzcyI6ImF1dGguZG9ja2VyLmlvIiwianRpIjoiMzlfNW9IV0MxWEl1Q1o2M1lhYWgiLCJuYmYiOjE1NTU0NzAzNDgsInN1YiI6IiJ9.rGHMrHh1akViCqE94AJs3aNc8D--gKzoNRuoE1P4kN61JtWhPs8YpluAQae4QRO-7ijOo5r-Nm8IcMIv-4uw-o1T3DNVEfE6o7tuEnjrblr_BzxDMrOUiN0NmuELTSQRZfM-EmcxvIdmlPlGfalPqg_oNGjyRtOoXs90AsVh34f-FFitoMqTUSKgn-0e7oeEJ3IIj2VhBOkyXUB73BSThLi8D7OrMK1G1DRA_vkrCUM5cnNPKnZ0EWiHnSY0lIY0EvDbnDzNsNpMSv235pHlSCRCjeKKQhcZ9WImbRQOMnKSinA-tp02vCq3HyocxgCMIcf8p9x5rdDcIzEaOr-jug' },
     Format: 'Docker' } }

##response
{ isVulnerable: false,
  image: 'ubuntu:14.04',
  layers:
   [...],
  vulnerabilities: [] }
  • 分析官方 iamge 后,从本地存储库分析图像
{ Layer:
   { Name: '390582d83ead410e808a4d1868a5b1a329241132a76565fd69ab23f60c032d81e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     Path: 'https://192.168.10.118:5000/v2/ubuntu/blobs/sha256:e082d449913058b0a86fef6c0208e5769b2d024c3bb465b13e53cc0da09e3c4c',
     ParentName: '',
     Headers:
      { 'User-Agent': 'node-clair-docker/1.0.0',
        authorization: undefined },
     Format: 'Docker' } }

##response
{ isVulnerable: false,
  image: 'http://192.168.10.118:5000/ubuntu:14.04',
  layers:
   [...],
  vulnerabilities: [] }
4

0 回答 0