Interview Prep/Docker/Build failures and cache problems

Build secret mount fails: `failed to solve: secret "npmrc" not found`

IntermediateTroubleshootingBuild failures and cache problems
Answer

Likely causes → --secret id=npmrc,src=... not passed, ID mismatch, or running with legacy builder.

Diagnose → Compare id= in the Dockerfile and CLI; check DOCKER_BUILDKIT.

Fix → docker build --secret id=npmrc,src=$HOME/.npmrc .; in Compose define build.secrets.

Prevent → Add a header # syntax=docker/dockerfile:1 and use BuildKit everywhere.

All Docker questions Roadmap: Docker & containers

More on Build failures and cache problems