Switch the runtime user away from root.
Section: Common Patterns
Run as non-root
dockerfile
dockerfile
RUN addgroup -S app && adduser -S app -G app
USER appExplanation
A common hardening practice for production images.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Common Patterns
Use multi-stage build
Build artifacts in one stage and copy only runtime output into the final stage.
Cache dependencies effectively
Copy dependency manifests before application code to maximize layer cache reuse.
Build from Dockerfile
Build an image from the Dockerfile in the current directory.