Description
apt-get install can ask for confirmation. A CI build can wait or fail when nobody can answer.
Potential impact
A stalled package installation can delay a deployment or recovery build.
Remediation
Use apt-get install -y (--yes or --assume-yes) and run the build without user input. Preconfigure any answers that package setup scripts need. Scope noninteractive settings to the install command and keep signature verification enabled.
Examples
Both examples refresh the package index before installing curl. Handle cache cleanup and version pinning separately.
Before
dockerfile
FROM ubuntu:24.04
RUN apt-get update && apt-get install curl
After
dockerfile
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y curl