Skip to main content
Use the -y switch to avoid manual input: dnf install -y <package>.
PropertyValue
SeverityWarning
CategoryBest Practice
DefaultEnabled
Auto-fixYes (--fix)

Description

Omitting the non-interactive switch causes the command to fail during the build process because dnf would expect manual input. Use the -y or the equivalent --assumeyes flag to ensure unattended operation inside a Dockerfile.

Examples

Problematic code

FROM fedora:32
RUN dnf install httpd-2.4.46 && dnf clean all

Correct code

FROM fedora:32
RUN dnf install -y httpd-2.4.46 && dnf clean all

Auto-fix

Adds -y flag to dnf and microdnf install, groupinstall, and localinstall commands.

Reference