Best way to scan dockerfile for specific command?

I’m trying to create a custom rule that checks to make sure our Dockerfiles are taking a specific image from the correct repository. It would be a very simple check, just looking for the presence of a single line of text in the file, e.g. FROM companyrepo.org/blessed-image.

Anyone know the best way to implement this? I was wondering if any of the custom rule templates that come with sonar out of the box could be used (of course, I’d have to change the file patterns that are being checked). I’d rather not have to create a plugin for such a simple rule.

Hey Alden.

You’d have to write a custom rule to do this—there’s no existing rule that would raise an issue when a specific image isn’t being used.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.