Containers: Keep the Image Small and Predictable
A development container can include build tools and credentials that production never needs. This guide gives you a small, testable way to approach the issue before changing a live system.
A practical workflow
- Use a multi-stage build and copy only runtime artifacts into the final image.
- Pin a suitable base image, scan dependencies and run the app as a non-root user where feasible.
What to check
Do not bake secrets into image layers; deleting a file in a later layer does not remove it from history. Compare the result with the original problem and record what changed. If a measurement or test does not support the change, revisit the assumption rather than adding more complexity.
Keep the experiment small enough to reverse. Document the starting state, the change and the result so another person can repeat the process. Product menus and versions can change, so check the current documentation for your environment.
Official reference: Read the documentation.