Dockerfiles should specify a base image

Metadata

ID: docker-best-practices/no-from-image

Language: Docker

Severity: Warning

Category: Best Practices

Description

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

RUN echo "hello"

Compliant Code Examples

FROM image as base

# foo

FROM image2
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis