Replies: 2 comments
-
|
I think this might be a bug as I see this line which doesn't line up with the reference cc @nikpivkin |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Track #9836 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
The trivy dockerfile scanner fails to parse valid Docker HEALTHCHECK instructions when performing Docker CIS compliance scans.
Specifically, when a HEALTHCHECK includes the
--start-periodflag (or other flags like--interval,--timeout), the dockerfile scanner produces an error claiming the flag is unknown, even though the Dockerfile syntax is completely valid.This error only appears during
--compliance docker-cis-1.6.0scans, not during regular vulnerability scans, indicating that the dockerfile scanner used by compliance checks has a bug in its HEALTHCHECK parser.Desired Behavior
--interval,--timeout,--start-period,--retries)Actual Behavior
When scanning an image with Docker CIS compliance that has a HEALTHCHECK with flags like
--start-period, trivy produces an error:The error is particularly confusing because:
--start-period(with a hyphen), not--startPeriod(camelCase)To reproduce:
Create a minimal Dockerfile with a HEALTHCHECK using the
--start-periodflag:Note: This uses
--start-period(with hyphen), which is the correct Docker syntax as documented at https://docs.docker.com/reference/dockerfile/#healthcheckBuild the image successfully:
docker build -t test-healthcheck .The build completes without errors, confirming the Dockerfile syntax is valid.
Verify the HEALTHCHECK was correctly configured:
Output:
{ "StartPeriod": 10000000000, "Test": [ "CMD-SHELL", "curl -f http://localhost:3000" ] }Run trivy with Docker CIS compliance scanning:
Observe the error in the output:
Note the paradox: The error suggests using
start-period(which we're already using), but shows it asstartPeriodin the error message.Verify that regular vulnerability scanning works fine without errors:
No dockerfile scanner errors appear - this bug only affects compliance scans.
Reproduction Steps
See above (properly formatted!)Target
Container Image
Scanner
None
Output Format
None
Mode
Standalone
Debug Output
Operating System
macOS 15.7.1
Version
Checklist
trivy clean --allBeta Was this translation helpful? Give feedback.
All reactions