Skip to content

buildkit/FromAsCasing

The AS and FROM keywords' casing should match.

Property Value
Severity Warning
Category Style
Default Enabled
Auto-fix Yes (--fix)

Description

While Dockerfile keywords can be either uppercase or lowercase, mixing case styles is not recommended for readability. This rule reports violations where mixed case style occurs for a FROM instruction with an AS keyword declaring a stage name.

Examples

Bad:

FROM debian:latest as builder

FROM is uppercase but as is lowercase.

Good:

FROM debian:latest AS deb-builder
from debian:latest as deb-builder

Both keywords use the same casing.

Auto-fix

The fix changes the AS keyword casing to match the FROM keyword.

# Before
FROM alpine as builder

# After (with --fix)
FROM alpine AS builder

Reference