Dockerfile Builder
Build a Dockerfile from a form, with multi-stage presets for Node, Python, Go, Nginx and more.
Dockerfile Builder
Build stage
Runtime stage
Dockerfile
History tool ini
Data terakhir yang pernah kamu isi di tool ini, tersimpan hanya di device/browser ini.
Save what you type here, in this browser? Your work would go into this browser's local storage, so a refresh or a trip to another tool does not wipe it. You also get a short list of previous entries under the form, each one restorable with a click. Nothing is ever uploaded, and there is no account.
Being straight about the trade-off: anything kept there can be read by anyone who can use this browser profile, and by any script that later runs on this site. A tool page can hold a private key, a password or a signed token. Saving is convenient; it is not private.
About this tool
Fill in a form and get a Dockerfile. Start from a preset for Node, Python, Go, a static site on Nginx, PHP or a Java Maven build, or from scratch, then adjust the base image, workdir, ENV, ARG, COPY, RUN, EXPOSE, VOLUME, USER, LABEL, HEALTHCHECK, ENTRYPOINT and CMD. Multi-stage builds get a builder stage and copy the artifacts into the runtime image. The output is built in the page and can be copied or downloaded as a Dockerfile.
Questions
- When is a multi-stage build worth it?
- When the tools that build the app are not the tools that run it: a Go binary needs the Go toolchain only at build time, and a Node app needs dev dependencies only to bundle. The runtime image then carries just the artifact, which is smaller and has fewer things to patch.
- What is the difference between ENTRYPOINT and CMD?
- ENTRYPOINT is the program that always runs; CMD supplies default arguments that a docker run command can override. If you set both, put the executable in ENTRYPOINT and the defaults in CMD. The page writes either as JSON when the value starts with [, otherwise as shell form.
- Why order the instructions this way?
- Docker caches one layer per instruction and rebuilds from the first changed layer onward. Copying dependency manifests and installing before copying the rest of the source means a code change does not re-install dependencies. Keep the slow, rarely-changing steps near the top.
- COPY or ADD?
- The page emits COPY, which is what you almost always want: it copies files and directories. ADD also unpacks local tarballs and can fetch URLs, which is convenient but surprising, so use it deliberately rather than by default.