Interview Prep/Docker/Build failures and cache problems

`Error: buildx failed with: ERROR: failed to solve: failed to push registry/app:tag: unexpected status: 401 Unauthorized`

BeginnerTroubleshootingBuild failures and cache problems
Answer

Likely causes → Not logged in as the user running the build (credentials come from the client's ~/.docker/config.json), token lacks push scope, or the repository does not exist.

Diagnose → docker login reg; cat ~/.docker/config.json; check token scopes.

Fix → Log in before building, grant write permission, create the repository (ECR).

Prevent → Use OIDC with least-privilege push roles.

All Docker questions Roadmap: Docker & containers

More on Build failures and cache problems