Skip to main content

DL3061: Dockerfile should start with FROM or ARG

Error Security

Why This Matters

A valid Dockerfile must begin with a FROM instruction (or ARG instructions before FROM for build-time variables). Any other instruction before FROM is invalid and will cause the build to fail. This rule catches structural errors early before they reach the build system.

How to Fix

Ensure FROM is the first non-ARG instruction

Before (incorrect)

RUN echo hello
FROM ubuntu:22.04

After (correct)

FROM ubuntu:22.04
RUN echo hello

Rule Details

Rule Code
DL3061
Severity
Error
Category
Security

Related Rules