Skip to main content
Version: Latest

Docker Installation

Run Codeward via Docker for consistent scanning across any CI system or local development.

Quick Start

Scan a repository with defaults:

docker run --rm \
-v /path/to/your/repo:/main:rw \
ghcr.io/codeward-io/scan:v0.3.0

Results go to stdout with default policies.

Persistent cache avoids re-downloading the vulnerability database on every run:

mkdir -p cache
docker run --rm \
-v /path/to/your/repo:/main:rw \
-v $(pwd)/cache:/.cache:rw \
ghcr.io/codeward-io/scan:v0.3.0

First run downloads the Trivy DB (~30s). Subsequent runs reuse it (~5s).

Air-Gapped / Offline

Set TRIVY_SKIP_DB_UPDATE=true to skip database downloads entirely. Useful for air-gapped environments with a pre-populated cache.

PR Diff Scan

Compare a feature branch against main:

docker run --rm \
-v /path/to/main-branch:/main:rw \
-v /path/to/feature-branch:/branch:rw \
-v $(pwd)/cache:/.cache:rw \
-e CODEWARD_MODE=diff \
ghcr.io/codeward-io/scan:v0.3.0

Results are categorized as new, changed, removed, or existing.

Full Example with GitHub Integration

mkdir -p results cache
docker run --rm \
-v /path/to/main-branch:/main:rw \
-v /path/to/feature-branch:/branch:rw \
-v $(pwd)/cache:/.cache:rw \
-v $(pwd)/results:/.results:rw \
-v $(pwd)/.codeward.yaml:/config/.codeward.yaml:ro \
-e CODEWARD_MODE=diff \
-e CODEWARD_CONFIG_PATH=/config/.codeward.yaml \
-e CODEWARD_GITHUB_TOKEN=$GITHUB_TOKEN \
-e CODEWARD_GITHUB_OWNER=myorg \
-e CODEWARD_GITHUB_REPOSITORY=myrepo \
-e CODEWARD_GITHUB_PR_NUMBER=123 \
ghcr.io/codeward-io/scan:v0.3.0

Volume Mounts

Container PathPurposeRequired
/mainMain/base branch checkoutYes
/branchFeature branch checkoutOnly for diff mode
/resultsFile-based report outputIf using file: destinations
/.cacheTrivy DB and scan cacheRecommended

Environment Variables

See CLI & Environment Variables for the complete list. Key variables:

VariableDefaultDescription
CODEWARD_MODEmaindiff or main
CODEWARD_CONFIG_PATH.codeward.json in repoConfig file path (YAML or JSON)
CODEWARD_PRIVATE_CONFIG_PATHPrivate config (merged with primary)
CODEWARD_CACHE_DIR/.cacheCache directory path
TRIVY_SKIP_DB_UPDATEfalseSkip Trivy DB download (air-gapped)
CODEWARD_GITHUB_TOKENGitHub API token
CODEWARD_GITHUB_OWNERRepository owner
CODEWARD_GITHUB_REPOSITORYRepository name
CODEWARD_GITHUB_PR_NUMBERPR number (diff mode)

Image Versions

TagUse Case
latestQuick experiments
v0.3.0Production (pinned)

Always pin versions in CI for reproducibility:

ghcr.io/codeward-io/scan:v0.3.0

Troubleshooting

SymptomFix
Permission denied writing resultschmod 777 results/ or adjust ownership
Cache not reusedMount a persistent host directory to /.cache
Everything marked "new"Mount main branch at /main and set CODEWARD_MODE=diff
No PR comment postedSet all CODEWARD_GITHUB_* variables

See Troubleshooting for more solutions.