File Format Support
Check Image automatically detects file format based on file extension:JSON
Files with
.json extensionYAML
Files with
.yaml or .yml extensionWhen reading from stdin with
-, format is auto-detected by content: JSON starts with { or [, otherwise treated as YAML.Configuration File Types
Check Image uses different configuration files for different purposes:Registry Policy Files
Define which container registries are trusted or blocked.- JSON
- YAML
config/registry-policy.json
Allowlist of trusted registries. Only images from these registries are allowed. Mutually exclusive with
excluded-registries.Blocklist of excluded registries. All registries except these are allowed. Mutually exclusive with
trusted-registries.Secrets Policy Files
Control secrets detection behavior and define exclusions for known safe patterns.- JSON
- YAML
config/secrets-policy.json
Enable environment variable scanning for sensitive patterns.
Enable file system scanning across all image layers.
File paths to exclude from scanning. Supports glob patterns with
** for recursive matching.Environment variable names to exclude from scanning (case-sensitive).
Additional environment variable patterns to detect (case-insensitive regex).
Additional file path patterns to detect (regex).
The secrets check works out-of-the-box with sensible defaults when no policy file is provided.
Labels Policy Files
Define required OCI annotations (labels) and their validation rules.- JSON
- YAML
config/labels-policy.json
Array of label validation rules. Each rule has a
name and optional value or pattern.Label name (OCI annotation key).
Exact value the label must have. Mutually exclusive with
pattern.Regular expression the label value must match. Mutually exclusive with
value.Validation modes:
- Existence check: Only
namespecified (label must be present) - Exact match:
nameandvaluespecified (label value must exactly match) - Pattern match:
nameandpatternspecified (label value must match regex)
Usage
Ports Policy Files
Define allowed exposed ports.- JSON
- YAML
config/allowed-ports.json
Array of allowed port numbers (integers).
The
@ prefix indicates a file path. Without it, the argument is treated as a comma-separated list.Platforms Policy Files
Define allowed OS/architecture combinations.- JSON
- YAML
config/allowed-platforms.json
Array of allowed platform strings in
OS/Architecture or OS/Architecture/Variant format.All Checks Configuration Files
Define which checks to run and their parameters for theall command.
- JSON
- YAML
config/config.json
Map of check names to their configuration. Only checks present in this object are executed.
Usage
Precedence rules:
- Without
--config: all 10 checks run with defaults - With
--config: only checks present in config file run --includeoverrides config file check selection--skipremoves checks from any selection- CLI flags override config file values
Inline Configuration
Theall command config file supports embedding policies directly as objects instead of file paths.
- JSON
- YAML
config/config-inline.json
Benefits
- Single file contains all configuration
- Easier version control
- Simpler deployment
- Mix inline and file references
Use Cases
- CI/CD pipelines
- Docker builds
- Kubernetes deployments
- Portable validation configs
Usage
Reading from Standard Input
All file arguments support reading from stdin using- as the path.
Dynamic Configuration from Pipelines
File Locations
Check Image looks for configuration files in the following locations:Explicit paths
Absolute or relative paths specified in flags (e.g.,
--registry-policy /etc/check-image/registry.json).Current directory
Files in the current working directory (e.g.,
--registry-policy registry-policy.json).Best Practices
Version control policies
Store policy files in your repository alongside your Dockerfile for versioned, traceable validation rules.
Use YAML for readability
YAML is more human-readable and easier to maintain than JSON for complex policies.
Validate policies
Test policy files with simple images before using them in production pipelines.
Document custom patterns
Add comments (in YAML) or a separate README explaining custom patterns and exclusions.
Related Topics
Image Reference Syntax
Learn about transport prefixes and image references
Authentication
Configure credentials for private registries
Output Formats
Control output format and color modes
All Command
Run multiple checks with a single configuration file