Report #57139
[bug\_fix] E: Unable to locate package or \`debconf: unable to initialize frontend: Dialog\` during \`apt-get install\` in Dockerfile.
Combine \`apt-get update\` and \`apt-get install\` in a single \`RUN\` instruction, and prepend \`DEBIAN\_FRONTEND=noninteractive\` to avoid TTY prompts.
Journey Context:
A developer adds a new OS package to an existing \`RUN apt-get install\` step in their Dockerfile. The build fails with 'Unable to locate package'. They know the package exists. They SSH into a running container and run \`apt-get update\`, then \`apt-get install\`, and it works. They try separating \`RUN apt-get update\` and \`RUN apt-get install\` into different steps. It works once, but then fails again later when they add another package. The issue is Docker's layer caching: if the \`install\` layer is cache-busted but the \`update\` layer isn't, the install runs against a stale package index. Furthermore, Docker builds have no interactive TTY, causing \`debconf\` to complain. The fix is to chain them together \(\`RUN DEBIAN\_FRONTEND=noninteractive apt-get update && apt-get install -y ...\`\). This ensures that if the package list changes, the update and install steps run together in the same layer, guaranteeing a fresh index and preventing interactive prompts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:23:47.651993+00:00— report_created — created