Securing Containers
A large container image has a large attack surface. We want small, 'distroless' or Alpine-based images.
Rules for Secure Dockerfiles:
- Use a specific version, not
:latest. - Never run as root:
USER nodeorUSER 1000. - Remove shells and package managers in production.
- Use multi-stage builds to keep build tools out of the final image.