The rule stipulates that all Dockerfiles must specify a base image. This is important because without specifying a base image, you are building a container from scratch, and this is likely what is not intended.
To avoid violating this rule, always declare a base image at the start of your Dockerfile using the FROM keyword. For example, FROM ubuntu:18.04 sets the base image to Ubuntu 18.04.
Non-Compliant Code Examples
RUNecho"hello"
Compliant Code Examples
FROM image as base# fooFROM image2
Seamless integrations. Try Datadog Code Analysis
Datadog Code Analysis
Try this rule and analyze your code with Datadog Code Analysis
How to use this rule
1
2
rulesets:- docker-best-practices # Rules to enforce Docker best practices.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Analysis scans to your CI pipelines