skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
docker-dockerfile
This page is read only. You can view the source, but not change it.
# Docker dockerfile **Dockerfile** is a text file listing instructions to build an image. Start with a base image (e.g., `FROM ubuntu:22.04`), then layer changes on top with `RUN`, `COPY`, `WORKDIR`, `ENV`, etc. Docker builds the image by executing each instruction sequentially, creating a new layer for each step. ```dockerfile FROM ubuntu:22.04 RUN apt-get update && apt-get install -y gcc make COPY . /app WORKDIR /app RUN make CMD ["./myprogram"] ``` Each instruction creates a layer. Docker caches layers—rebuilding reuses unchanged layers up to the first change, then re-executes from there. Put instructions that change frequently (like `COPY .`) near the end to maximize cache hits. Never split `apt-get update` and `apt-get install` into separate `RUN` instructions—the install might use a stale cached update layer.
Page Tools
Show pagesource
Backlinks
Back to top