-
Notifications
You must be signed in to change notification settings - Fork 8.3k
dhi: add malware scan info #24729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
dhi: add malware scan info #24729
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| --- | ||
| title: Malware scanning | ||
| description: Learn how Docker scans Docker Hardened Images for viruses and malware using ClamAV, and how to view and verify the scan attestation. | ||
| keywords: docker hardened images, malware scanning, virus scan, clamav, attestation, image security | ||
| weight: 50 | ||
| --- | ||
|
|
||
| The Docker Hardened Image (DHI) pipeline scans for viruses and malware as part | ||
| of the build process. The scan results are embedded as a signed attestation, | ||
| which you can independently retrieve and verify. | ||
|
|
||
| ## How it works | ||
|
|
||
| Docker uses [ClamAV](https://www.clamav.net/), an open source antivirus engine, | ||
| to scan every layer of each image. The scan runs automatically during the build | ||
| process and checks all files in the image, including files inside archives, for | ||
| known viruses and malware signatures. | ||
|
|
||
| The scan results are published as a signed attestation attached to the image. | ||
| The attestation includes the full ClamAV scan report, including the number of | ||
| files scanned, the virus signature database version, and whether any infected | ||
| files were detected. | ||
|
|
||
| ## View the malware scan attestation | ||
|
|
||
| You can retrieve the malware scan attestation using the Docker Scout CLI. | ||
|
|
||
| 1. Use the `docker scout attest get` command with the virus scan predicate type: | ||
|
|
||
| ```console | ||
| $ docker scout attest get \ | ||
| --predicate-type https://scout.docker.com/virus/v0.1 \ | ||
| --predicate \ | ||
| dhi.io/<image>:<tag> | ||
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > | ||
| > If the image exists locally on your device, you must prefix the image name | ||
| > with `registry://`. For example, use `registry://dhi.io/python` instead of | ||
| > `dhi.io/python`. | ||
|
|
||
| For example: | ||
|
|
||
| ```console | ||
| $ docker scout attest get \ | ||
| --predicate-type https://scout.docker.com/virus/v0.1 \ | ||
| --predicate \ | ||
| dhi.io/python:3.13 | ||
| ``` | ||
|
|
||
| The output is a JSON object containing the scanner used and the base64-encoded | ||
| scan report: | ||
|
|
||
| ```json | ||
| { | ||
| "scanner": { | ||
| "report": "<base64-encoded ClamAV report>", | ||
| "uri": "clamav/clamav:stable" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Decoding the report shows the full ClamAV output, ending with a scan summary: | ||
|
|
||
| ```text | ||
| ----------- SCAN SUMMARY ----------- | ||
| Known viruses: 3627833 | ||
| Engine version: 1.5.2 | ||
| Scanned directories: 4 | ||
| Scanned files: 21 | ||
| Infected files: 0 | ||
| Data scanned: 44.90 MiB | ||
| Data read: 23.88 MiB (ratio 1.88:1) | ||
| Time: 11.473 sec (0 m 11 s) | ||
| Start Date: 2026:04:12 02:36:19 | ||
| End Date: 2026:04:12 02:36:30 | ||
| ``` | ||
|
|
||
| 2. Verify the attestation signature. To ensure the attestation is authentic and | ||
| signed by Docker, run: | ||
|
|
||
| ```console | ||
| $ docker scout attest get \ | ||
| --predicate-type https://scout.docker.com/virus/v0.1 \ | ||
| --verify \ | ||
| dhi.io/<image>:<tag> --platform <platform> | ||
| ``` | ||
|
|
||
| If the attestation is valid, Docker Scout confirms the signature and shows | ||
| the matching `cosign verify` command. | ||
|
|
||
| To view other attestations, such as SBOMs or test results, see [Verify | ||
| an image](../how-to/verify.md). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also unset
weightto let it sink to the bottom - pages with any weight are always ranked higher than weightless pages.