Skip to main content

DL3027: Do not use apt as it is meant to be an end-user tool

Warning Best Practice

Why This Matters

The `apt` command is designed for interactive terminal use. It shows progress bars, colors, and prompts that break in non-interactive Docker builds. apt-get is the stable, scriptable interface with a guaranteed CLI API. Using `apt` in Dockerfiles can cause build failures when the output format changes or when running in non-TTY environments. Always use apt-get or apt-cache instead.

How to Fix

Replace apt with apt-get

Before (incorrect)

RUN apt install -y curl

After (correct)

RUN apt-get install -y curl

Rule Details

Rule Code
DL3027
Severity
Warning
Category
Best Practice

Related Rules