Building images, topic 18 of 41
Dockerfiles
A Dockerfile is the recipe for an image. FROM picks the base, WORKDIR sets the directory, COPY brings files in, RUN runs commands at build time, ENV and ARG set variables, USER picks who runs it, and CMD and ENTRYPOINT say what starts.
Build with docker build -t name .. Learn the difference between CMD and ENTRYPOINT, and why the exec form, ["node", "server.js"], lets your program receive signals and stop cleanly. docker init writes a starting Dockerfile for common languages.
On Opsfolk
Nothing of ours for this topic yet: an article is on its way.
Elsewhere
- Dockerfile referenceOfficial
- Dockerfile overviewOfficial
- docker initOfficial