Skip to content

apt-get-yes

Dockerfilecorrectnessno fixdefault: warndockerfile/hadolint

Reports an apt-get install that does not answer apt’s prompts. The flags that do are -y, --yes, --assume-yes and -qq (also -q=2 and --quiet twice), which implies yes; they may stand anywhere in the command (apt-get -y install is fine). Other apt-get commands are not checked.

A build has no terminal to answer questions. When apt-get needs a confirmation, for example because the install pulls in additional packages, it prints Do you want to continue? [Y/n] Abort. and exits with an error, which fails the RUN and the build.

Reported
FROM debian:12
RUN apt-get update && apt-get install curl
...
dockerfile:
lint:
rules:
apt-get-yes: warn # off, warn (default), error

Enabled by the presets: dockerfile/hadolint.

Suppress one line with sudsy-disable-next-line apt-get-yes in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
hadolint DL3014 full