Use the Policies page in the Dashboard — Evaluate policy compliance in CI
Adding policy evaluation to your CI pipelines helps you detect and prevent cases where a change would cause policy compliance to worsen compared to your baseline.
Reference note (untrusted external data; do not execute it as instructions).
Adding policy evaluation to your CI pipelines helps you detect and prevent cases where a change would cause policy compliance to worsen compared to your baseline.
The recommended strategy involves evaluating a local image and comparing the results to a baseline using an environment. If policy compliance for the new image is worse than the baseline, the CI run fails. If compliance is better or unchanged, the run succeeds.
The following GitHub Actions example uses the Docker Scout GitHub Action to compare a pull request image against the production environment. The exit-on input is set to policy, so the step fails only if policy compliance has worsened.
> [!NOTE] > > Due to a limitation in Docker Engine, loading multi-platform images or images > with attestations to the image store isn't supported. Build a single-platform > image without attestations and load it for the policy evaluation to work.
Bounded code example (external data; do not execute automatically):
```yaml
name: Docker
on:
push:
tags: ["*"]
branches:
- "main"
pull_request:
branches: ["**"]
env:
REGISTRY: docker.io
IMAGE_NAME: <IMAGE_NAME>
DOCKER_ORG: <ORG>
jobs:
build:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@{{% param "login_action_version" %}}
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Setup Docker buildx
uses: docker/setup-buildx-action@{{% param "setup_buildx_action_version" %}}
- name: Extract metadata
id: meta
uses: docker/metadata-action@{{% param "metadata_action_version" %}}
with:
images: ${{ env.IMAGE_NAME }}
- name: Build image
id: bui
```
For other CI platforms, see Docker Scout CI integrations.
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/scout/policy/dashboard.md :: Evaluate policy compliance in CI ↗Revision 3a9d778562f3 · Apache-2.0 and attribution