Skip to main content

Why is it a bad practice to store secrets inside images?

Junior Docker
Quick Answer Images are shareable and often public (or accessible to anyone with registry access). Baking secrets (API keys, DB passwords) into an image means everyone who pulls it gets the secrets รขโ‚ฌโ€ forever, even after you "delete" them, because they're in the layer history. Use environment variables or secrets managers at runtime instead.

Answer

Images can be extracted or shared, exposing secrets permanently. Secrets cannot be revoked once baked into images.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice