Summary
Issue: Docker build stalls during apt install ttf-mscorefonts-installer due to a license agreement prompt requiring user input.
Impact: Automated builds fail, requiring manual intervention post-container creation.
Root Cause
The ttf-mscorefonts-installer package requires explicit acceptance of its license terms during installation. The -y flag in apt install does not bypass this prompt, causing the build process to halt.
Why This Happens in Real Systems
- Interactive prompts: Some packages require user interaction (e.g., license agreements) that cannot be automatically handled by
apt -y. - Non-headless environment: Docker builds run in a non-interactive (headless) mode, so stdin is not available for manual input.
Real-World Impact
- Build failures: Automated CI/CD pipelines fail, delaying deployments.
- Manual workarounds: Engineers must install the package manually after container startup, increasing complexity.
- Inconsistent environments: Containers built manually vs. automated may differ, leading to reproducibility issues.
Example or Code
RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \
apt-get update && \
apt-get install -y ttf-mscorefonts-installer
How Senior Engineers Fix It
- Pre-accept license terms: Use
debconf-set-selectionsto automatically accept the license agreement. - Automate in Dockerfile: Include the fix directly in the
RUNcommand to ensure consistent builds. - Document the workaround: Share the solution with the team to prevent recurrence.
Why Juniors Miss It
- Lack of awareness: Juniors may not know about
debconf-set-selectionsor how apt handles interactive packages. - Overreliance on
-y: Assuming-ybypasses all prompts without understanding package-specific behavior. - Limited debugging experience: Difficulty identifying the root cause when builds stall unexpectedly.