Skip to content

Docker

The image ghcr.io/witnyx/witnyx runs witnyx in any CI job that can start a container with docker run. There is no binary to download and check: Docker pulls the image by its tag. To be sure that the image never changes under you, add its digest to the tag, as in ghcr.io/witnyx/witnyx:0.1.0@sha256: followed by the digest.

Run it in the project folder, after the step that writes the software bill of materials (SBOM) to bom.json. Your first check shows how to make one.

Terminal window
docker run --rm \
--user "$(id -u):$(id -g)" \
--volume "$PWD:/work" \
ghcr.io/witnyx/witnyx:0.1.0 \
check bom.json --no-agent --cache-dir .witnyx-cache --output json=witnyx-report.json --output markdown=witnyx-report.md
  • --volume "$PWD:/work" mounts the project in /work, the image’s working folder. Paths in the command are taken from there, so bom.json, .witnyx-cache and the reports are in the project folder.
  • --user "$(id -u):$(id -g)" runs the container as the job’s own user. The image’s own user, nonroot, usually cannot write to the mounted folder, and the files it wrote would not belong to the job.
  • Everything after the image is the witnyx command and its options. docker run exits with the check’s exit code: 1 when a --fail-on rule triggers, 2 when the check cannot run.
  • --no-agent keeps the text report in the log. The container sees none of the job’s variables unless you pass them with --env, but the option makes that explicit.

Without --cache-dir, Witnyx keeps the public lists in the container’s home folder, and --rm deletes them with the container. With --cache-dir .witnyx-cache, they stay in the project folder. Point your CI’s cache at that folder:

  • GitHub Actions: restore and save .witnyx-cache as the GitHub Actions recipe does with its folder.
  • GitLab CI: list .witnyx-cache/ under cache:paths, as in the GitLab CI recipe.
  • Jenkins: keep the cache in a folder of the agent instead. Create it with mkdir -p "$HOME/.cache/witnyx" before the first run, because Docker would create a missing folder for root. Then mount it with --volume "$HOME/.cache/witnyx:/cache" and pass --cache-dir /cache.

Witnyx uses a cached copy that is less than 24 hours old, and downloads an older one again. When a download fails, it uses a cached copy up to 7 days old, and the report says so. How a check works describes each source.

The reports are files in the project folder. Keep them as your CI’s artifacts, also when the check failed the job. The JSON report is the record of the run: checkedAt says when the check ran, and each actively exploited finding repeats it as awareAt. Report formats describes each format.

The image holds only the native binary, on a minimal base without a shell. A GitLab CI job image or a Jenkins agent { docker { ... } } runs shell commands inside the container, so the image cannot be either. Run it with docker run from the job, as above, or use the release binary: see GitLab CI and Jenkins.

Until launch, you can build the image yourself and use witnyx:dev in place of the image name: see Build from source.

Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.