</>CodexBash
All articles
DevOps

Writing a good Dockerfile

Turn a slow, bloated Dockerfile into a small, fast, secure one: choosing a base image, ordering layers for the cache, .dockerignore, multi-stage builds, running as a non-root user, keeping secrets out, and health checks.

CodexBash, , 5 min read

A Dockerfile that "works" can still produce a 2 GB image that rebuilds from scratch on every change, runs as root and carries your API keys inside it. The difference between that and a good Dockerfile is a handful of habits. This article walks through them with a Node.js example, though every point applies to Java, Python and Go as well.

Sign in to read the rest

The whole 5 minute article is free with an account, along with every problem, lesson and tutorial. No card.