Skip to content

What it is

A Dockerfile is the declarative recipe that Docker build executes to produce a container image, one instruction at a time.

A Dockerfile is not a shell script. It is a small DSL: each instruction (FROM, RUN, COPY, CMD, ENTRYPOINT, WORKDIR, ENV, EXPOSE, USER, HEALTHCHECK, ARG, LABEL, VOLUME) contributes one layer to the image. Docker builds the image layer by layer; layers are cached, and cache misses invalidate every subsequent layer.