检查容器/镜像/dockerfile的通用规则/最佳实践的工具。
项目描述
Colin
检查容器镜像和dockerfile的通用规则和最佳实践的工具。
有关更多信息,请参阅我们的colin.readthedocs.io文档。
功能
- 验证选定的工件是否与规则集兼容。
- 工件可以是容器镜像和dockerfile。
- 我们提供了一个默认的规则集,我们认为每个容器镜像都应该满足。
- 有一个规则集来验证工件是否符合Fedora容器指南
- Colin可以列出可用的规则集和列出规则集中的检查。
- 有一个Python API可用
- Colin可以轻松集成到您的流程中 - 它可以以json格式提供结果。
安装
通过pip
如果您在Fedora发行版上,请安装python3-pyxattr,这样您在从PyPI获取时就不需要自行编译。
$ pip3 install --user colin
colin
只支持Python 3.6+。
Fedora发行版上
colin包含在官方Fedora仓库中
$ dnf install -y colin
需求
-
为了检查
image
目标类型,您必须安装podman。如果您需要检查本地Docker镜像,您需要使用docker-daemon
作为镜像的前缀(例如:colin check docker-daemon:docker.io/openshift/origin-web-console:v3.11
)。 -
如果您想使用
oci
目标,您需要安装以下工具
使用方法
$ colin --help
Usage: colin [OPTIONS] COMMAND [ARGS]...
COLIN -- Container Linter
Options:
-V, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
check Check the image/dockerfile (default).
info Show info about colin and its dependencies.
list-checks Print the checks.
list-rulesets List available rulesets.
$ colin check --help
Usage: colin check [OPTIONS] TARGET
Check the image/dockerfile (default).
Options:
-r, --ruleset TEXT Select a predefined ruleset (e.g. fedora).
-f, --ruleset-file FILENAME Path to a file to use for validation (by
default they are placed in
/usr/share/colin/rulesets).
--debug Enable debugging mode (debugging logs, full
tracebacks).
--json FILENAME File to save the output as json to.
--stat Print statistics instead of full results.
-s, --skip TEXT Name of the check to skip. (this option is
repeatable)
-t, --tag TEXT Filter checks with the tag.
-v, --verbose Verbose mode.
--checks-path DIRECTORY Path to directory containing checks (default
['/home/flachman/.local/lib/python3.7/site-
packages/colin/checks']).
--pull Pull the image from registry.
--target-type TEXT Type of selected target (one of image,
dockerfile, oci). For oci, please specify
image name and path like this: oci:path:image
--timeout INTEGER Timeout for each check in seconds.
(default=600)
--insecure Pull from an insecure registry (HTTP or invalid
TLS).
-h, --help Show this message and exit.
让我们试试看
$ colin -f ./rulesets/fedora.json registry.fedoraproject.org/f29/cockpit
PASS:Label 'architecture' has to be specified.
PASS:Label 'build-date' has to be specified.
FAIL:Label 'description' has to be specified.
PASS:Label 'distribution-scope' has to be specified.
:
:
PASS:10 FAIL:8
直接从git
您可以直接从git使用colin
$ git clone https://github.com/user-cont/colin.git
$ cd colin
现在我们可以运行分析
$ python3 -m colin.cli.colin -f ./rulesets/fedora.json registry.fedoraproject.org/f29/cockpit
PASS:Label 'architecture' has to be specified.
PASS:Label 'build-date' has to be specified.
FAIL:Label 'description' has to be specified.
PASS:Label 'distribution-scope' has to be specified.
:
:
PASS:10 FAIL:8
退出代码
Colin可以以几个代码退出
0
--> 正常1
--> 执行错误2
--> CLI错误,参数错误3
--> 至少有一个检查失败
项目详情
下载文件
下载您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
colin-0.5.3.tar.gz (604.4 kB 查看哈希值)
构建分发
colin-0.5.3-py3-none-any.whl (78.1 kB 查看哈希值)
关闭
colin-0.5.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5fd718c1e1d2270ace39225c4c8b8cecdf5fb29664fe361c0107a54a55bd500d |
|
MD5 | a6e69fe2d32a1a2c4e5337dd172786d9 |
|
BLAKE2b-256 | 4efd2608a6a723893fc09f7f3f58b1d4932f43773ef46e69b3b000bf56625d9a |
关闭
colin-0.5.3-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a0d6ac0b72a1c2d5a7c5d29fb0d83edc7159887c2eff39b5bfc16c7f2a818e76 |
|
MD5 | 1731ee54a83491c6288da1e13211c158 |
|
BLAKE2b-256 | c8b28b7815bcd06ada5731ae2fb6494d60b3106fa82a53596b69628c511144b1 |