漏洞知识库
点击放大

!Maintenance
![Build Status]()
![Go Report Card]()
![Co Status]()
When you work with containers (Docker) you are not only packaging your application but also part of the OS. It is crucial to know what kind of libraries might be in your container. One way to find this information is to look at the Docker registry [Hub or Quay.io] security scan. This means your image is already on the Docker registry.
What you want is a scan as a part of CI/CD pipeline that stops the Docker image push on :
1. Build and test your application
1. Build the container
1. Test the container for
1. Check the against allowed ones, if e is allowed then pass otherwise fail
This straightforward process is not that easy to achieve when using the services like Docker Hub or Quay.io. This is because they work asynchronously which makes it harder to do straightforward CI/CD pipeline.
CoreOS has created an awesome container scan tool called Clair. Clair is also used by Quay.io. What clair does not have is a simple tool that scans your image and compares the against a whitelist to see if they are approved or not.
This is where clair-scanner comes into place. The clair-scanner does the following:
* Scans an image against Clair server
* Compares the against a whitelist
* Tells you if there are that are not in the whitelist and fails
* If e is fine it completes correctly
For the clair-scanner to work, you need a clair server. It is not always con to have a dedicated clair server, therefore, I ha a way to run this standalone. See here <
The clair-scanner is a copy of the Clair 'analyze-local-images' < with changes/impro and addition that checks the against a whitelist.
clair-scanner is a on Linux, MacOS, and Windows platforms.
* Binaries for Linux, Windows, and Mac are a in the releases page.
* You can also install from source. To do so you must:
1. Have go 1.11+ installed
1. Clone the repo
1. Build and install the executable
clair-scanner is built with Go 1.14. Use the Makefile to build and install dependencies.
Cross compile:
Example of a container scan, start Clair:
Now scan a container, that has a whitelisted CVE (this is on OSX with Docker for Mac):
Output:
Or a container that does not have a whitelisted CVE (this is on OSX with Docker for Mac):
Output:
Example of a single bash script to run clair-scanner:
Copy example-run.sh to /usr/local/bin/clair-scanner
This is an example yaml file. You can have an empty file or a mix with only generalwhitelist or images.
If you get [CRIT] ▶ Could not sa image [image:]: Error response from daemon: reference does not exist, this means that image image: is not locally present. You should have this image present locally before trying to analyze it (e.g.: docker pull image:).
Errors like [CRIT] ▶ Could not analyze layer: Clair responded with a failure: Got response 400 with message {"Error":{"Message":"could not find layer"}} indicates that Clair can not retrieve a layer from clair-scanner. This means that you probably specified a wrong IP address in options (--ip). Note that you should use a publicly accessible IP when clair is running in a container, or it wont be able to connect to clair-scanner. If clair is running inside the docker, use the docker0 ip address. You can find the docker0 ip address by running ifconfig docker0 | grep inet
[CRIT] ▶ Could not read Docker image layers: manifest.json is not valid fires when image is not specified and is required. Try to add : (.e.g. :latest) after the image name.
[CRIT] ▶ Could not analyze layer: POST to Clair failed Post dial tcp: lookup docker on 127.0.0.53:53: no such host indicates that clair ser ne be reached. Double check hostname and port in -c argument, and your clair settings (in clair's docker-compose.yml for instance if you run it this way).
To make a release create a tag and push it
开发语言:Go
Star 数:864
该项目属于漏洞知识库方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕Docker containers vulnerability scan展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | clair-scanner - Docker containers vulnerability scan |
| 所属分类 | 漏洞知识库 |
| 发布作者 | admin |
| 发布时间 | 2026-10-06 01:05:16 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 344 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |