Prerequisites
Install Check Image
If you haven’t installed Check Image yet, follow the installation guide.Quick install with Homebrew:
Your First Validation
Let’s validate the official nginx image with a simple age check:Understanding the Output
Successful validation:Common Validation Checks
Now let’s try the most common security and operational checks:Check Image Size
Validate that an image is smaller than 200MB:This ensures images stay lean and deploy quickly. Large images can:
- Slow down deployments
- Increase network transfer costs
- Contain unnecessary dependencies
Check for Root User
Verify the image runs as a non-root user:For nginx, this check will fail because the official image runs as root. Let’s try a safer image:
Check for Secrets
Scan for embedded passwords, tokens, and keys:This scans:
- Environment variables for sensitive patterns (password, secret, token, key)
- Files across all layers for SSH keys, cloud credentials, password files
Run All Checks at Once
Instead of running checks individually, use theall command to run multiple checks:
We skip
registry, labels, and platform checks because they require additional configuration files. We’ll cover those in the next section.Understanding the All Command Output
Text output shows a summary:Using Configuration Files
For production use, define all your validation rules in a config file:Working with Different Image Sources
Check Image supports multiple image transport formats:JSON Output for Scripting
All commands support JSON output for integration with scripts and tools:jq for parsing:
Exit Codes for CI/CD
Check Image uses standard exit codes:| Exit Code | Meaning | Example |
|---|---|---|
| 0 | Validation succeeded | All checks passed |
| 1 | Validation failed | Image too old, runs as root |
| 2 | Execution error | Image not found, invalid config |
Using in CI/CD Pipelines
GitHub Actions
Add to your workflow:.github/workflows/validate.yml
Docker
Use the Docker image in any CI system:Next Steps
Now that you’ve validated your first images, explore the full command reference:Age Check
Validate image freshness and age limits
Size Check
Control image size and layer count
Security Checks
Verify non-root users, secrets, and ports
All Command
Run comprehensive validation suites
Common Issues
Error: image not found
Error: image not found
Make sure:
- The image name and tag are correct
- You have network access to the registry
- For private registries, you’re authenticated (
docker loginor use--username/--password-stdin) - For local images, Docker daemon is running
Error: exit code 2 (execution error)
Error: exit code 2 (execution error)
This usually means:
- Invalid command syntax or arguments
- Missing required configuration files
- Config file has invalid JSON/YAML syntax
- Image reference format is incorrect
Check shows 'dev' version
Check shows 'dev' version
If installed with
go install, version shows as dev. This is normal.For production use with proper version numbers, use:- Pre-built binaries from releases
- Homebrew installation
- Docker image
- GitHub Action
Private registry authentication failed
Private registry authentication failed
For private registries, provide credentials: