Dockerfile
A Dockerfile is a text file containing instructions for building a Docker container image.
Learn Docker in a Month of Lunches, Second Edition
A Dockerfile is a text configuration file that specifies how to build a Docker container image.
- How it is used
- Automates application packaging into Docker images so containers can run across development and deployment environments.
- How deep it goes
- Works through core instructions, cache-aware ordering, and multi-stage builds, including Java, Node.js, Go, and Windows packaging.
- Examples
- Uses a Node.js web-ping Dockerfile, Java and Go build stages, a Windows MSI installer, and a Go optimization lab.
- What you can do after
- Build it from scratch: write and optimize Dockerfiles that package applications from source into runnable images.
Read how Learn Docker in a Month of Lunches, Second Edition explains Dockerfile →
Build Python Web Apps with Streamlit
A Dockerfile is a text file containing instructions for defining the environment and build steps of a Docker image.
- How it is used
- Packages a Streamlit app and its environment for consistent local execution and cloud deployment.
- How deep it goes
- Explains image instructions, layer caching, secret exclusion, and local build and run steps; leaves self-managed PostgreSQL and multi-container setup aside.
- Examples
- Uses a Streamlit trivia app with requirements.txt, a Python 3.12 Dockerfile, .dockerignore, and local build and run commands.
- What you can do after
- Apply Docker to build a Streamlit image, run it locally with port mapping, and keep secrets out of the image.
Read how Build Python Web Apps with Streamlit explains Dockerfile →
Road to Kubernetes
A Dockerfile is a text-based configuration file that specifies how to build a container image.
- How it is used
- Defines repeatable instructions for building an application image instead of modifying a running container.
- How deep it goes
- Works through core directives and image builds, while leaving intricate Dockerfile design aside.
- Examples
- Uses an Ubuntu-and-NGINX image, then Python and Node.js application Dockerfiles.
- What you can do after
- Build it from scratch with Dockerfile directives, then build and run a tagged application image using Docker.
Rust Servers, Services, and Apps
A Dockerfile is a text configuration file containing instructions for building a Docker image.
- How it is used
- Packages Rust web services into reproducible Docker images for development testing and production deployment.
- How deep it goes
- Builds a basic image step by step, then covers multistage builds and static musl binaries, without detailing every Docker instruction.
- Examples
- Uses an Actix Web service, Dockerfile-basic, a 1.32 GB image, and a musl-based multistage packaging strategy.
- What you can do after
- Builds and runs a Dockerized Rust web service, then reduces its image footprint with static and multistage packaging.
Read how Rust Servers, Services, and Apps explains Dockerfile →
Kubernetes for Developers
A Dockerfile is a text file containing instructions for building a Docker container image.
- How it is used
- Records application dependencies and configuration as repeatable instructions for building a container image.
- How deep it goes
- Works through Python image construction and Java compilation, then briefly identifies multistage builds without detailing their Dockerfile instructions.
- Examples
- Uses Ubuntu and Python 3 for one Dockerfile and OpenJDK with javac for another, alongside build-and-run commands.
- What you can do after
- Build it from scratch by choosing a base image, adding the application and dependencies, and building the resulting image with Docker.
Google Anthos in Action
A Dockerfile is a text configuration file containing instructions for building a Docker container image.
- How it is used
- Packages migrated VM application content and runtime dependencies into a deployable container image for Kubernetes.
- How deep it goes
- Explains multistage structure, customization points, entry point, image rebuilding, and rolling updates without detailing Docker build internals.
- Examples
- Uses Migrate for Anthos runtime and source-content stages, package-install commands, generated YAML artifacts, and rolling image updates.
- What you can do after
- Apply it by editing generated stages, rebuilding a layered image, and updating the Kubernetes deployment.
Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
A Dockerfile is a script containing instructions for building a Docker image and specifying its included code and assets.
- How it is used
- Packages a microservice into a Docker image ready for testing, publishing, and deployment.
- How deep it goes
- Explains the instruction sequence and validates image creation with docker build, but does not develop advanced production Dockerfile practices.
- Examples
- Uses a Node.js video-streaming microservice containing source files, npm dependencies, and a sample video.
- What you can do after
- Builds and inspects a tagged Docker image from a project directory using docker build and docker image list.
Build Financial Software with Generative AI (From Scratch)
A Dockerfile is a text configuration file containing instructions for building a container image.
- How it is used
- Builds container images for a FastAPI service and a Next.js dashboard managed with Docker Compose.
- How deep it goes
- Explains core instructions, build arguments, caching order, and troubleshooting through complete Dockerfile examples.
- Examples
- Uses Python Alpine API and Node Alpine dashboard Dockerfiles, including dependency installation and startup commands.
- What you can do after
- Build it from scratch for an API or dashboard, configure its startup and build arguments, and order instructions for caching.
Read how Build Financial Software with Generative AI (From Scratch) explains Dockerfile →
.NET in Action, Second Edition
A Dockerfile is a text file containing instructions for building a Docker container image.
- How it is used
- Specifies how Docker builds a customized .NET service image, especially when built-in container publishing is unavailable or insufficient.
- How deep it goes
- Works through single-stage and multi-stage instructions, file exclusions, and a build command without detailing every Dockerfile instruction.
- Examples
- Uses a .NET service Dockerfile, a .dockerignore file, a tagged `docker build`, and SDK-to-runtime multi-stage variants.
- What you can do after
- Build it from scratch with Docker: configure a .NET service image, exclude local artifacts, and publish into a separate runtime stage.
Read how .NET in Action, Second Edition explains Dockerfile →
Data Pipelines with Apache Airflow, Second Edition
A Dockerfile is a text file containing instructions for building a Docker image.
- How it is used
- Packages task scripts and dependencies into images for DockerOperator execution, or DAG files into an Airflow deployment image.
- How deep it goes
- Works through Dockerfile instructions, building and testing an image, then outlines image publishing and worker execution without detailing Docker internals.
- Examples
- Uses a weather-fetching CLI image, a movie-ratings task image, and an Airflow image that includes DAG files.
- What you can do after
- Build it from scratch: write a Dockerfile for a Python task, build and test its image, and prepare it for DockerOperator use.
Read how Data Pipelines with Apache Airflow, Second Edition explains Dockerfile →
Fast by Default
A Dockerfile is a text configuration file containing instructions for building a container image.
- How it is used
- Analyzes Dockerfile instructions to control container image size and production contents.
- How deep it goes
- Explains layers, immutable filesystem changes, size inspection, caches, base images, and multi-stage builds.
- Examples
- Uses a checkout API, docker history output, Dive layer browsing, and a Python 3.11 multi-stage Dockerfile.
- What you can do after
- Diagnose image-size problems with docker history and Dive, then reduce production contents with multi-stage builds.
Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more
A Containerfile or Dockerfile is a declarative build file that specifies how to construct a container image and its default runtime metadata.
- How it is used
- Automates repeatable container-image construction and records default behavior for containers launched from the image.
- How deep it goes
- Explains rootfs population, layered RUN execution, runtime directives, and a complete build workflow, but does not detail every directive.
- Examples
- Uses package installation, an HTTP application, context files, podman build, image tagging, pushing, and dangling-image cleanup.
- What you can do after
- Build it from scratch with Containerfile instructions and podman build, then tag, push, inspect, test, replace, or prune images.
AI-Powered Developer: Build software with ChatGPT and Copilot
A Dockerfile is a text-based build specification containing instructions for creating a Docker image.
- How it is used
- Supports the transition from tested application code to locally tested, containerized deployment artifacts.
- How deep it goes
- Defines Dockerfile structure and demonstrates generation, image building, and container execution without detailing advanced optimization.
- Examples
- Uses a Python 3.10 application with main.py, requirements.txt, port 8080, and docker build and docker run commands.
- What you can do after
- Build it from scratch with an AI assistant, review its instructions, create an image, and test the resulting container locally.
Read how AI-Powered Developer: Build software with ChatGPT and Copilot explains Dockerfile →
Kubernetes in Action, Second Edition
A Dockerfile is a text configuration file containing instructions for building a Docker container image.
- How it is used
- Packages an application into a portable container image for local execution and later use with Kubernetes.
- How deep it goes
- Explains base images, file copying, startup commands, image layers, and build output through one minimal example.
- Examples
- Uses a Node.js application with app.js and html files, then demonstrates docker build, docker images, and docker history.
- What you can do after
- Build it from scratch with Docker, tag the resulting image, and inspect its contents and construction history.
Read how Kubernetes in Action, Second Edition explains Dockerfile →
Distributed Machine Learning Patterns
A Dockerfile is a declarative text file containing instructions for building a Docker container image.
- How it is used
- Packages distributed-training code and dependencies into an image used by Kubernetes workers and sequential workflow steps.
- How deep it goes
- Defines a base image, dependency installation, and file copying, then stops short of storage persistence and workflow orchestration.
- Examples
- Uses a Python 3.9 image with pinned TensorFlow packages and a copied multi-worker training script.
- What you can do after
- Builds and imports a tagged training image for execution in a local k3d Kubernetes cluster.
Read how Distributed Machine Learning Patterns explains Dockerfile →
Enterprise RAG
A Dockerfile is a text configuration file containing instructions for building a container image.
- How it is used
- Packages a Python application into a reproducible container image for laptop and Azure App Service deployment.
- How deep it goes
- Explains directives line by line, including dependency rationale, build context, startup, ports, and secret exclusion.
- Examples
- Uses a Python 3.11 image, libgomp1 installation, requirements.txt, port 8000, .env exclusion, and build-run commands.
- What you can do after
- Build it from scratch and run it with pinned dependencies, environment-file injection, port mapping, and a direct Python startup command.
Spring in Action, Sixth Edition
A Dockerfile is a text configuration file containing instructions for building a container image.
- How it is used
- Builds a container image from a Spring Boot application's executable JAR for deployment and execution across container platforms.
- How deep it goes
- Explains a minimal four-instruction Dockerfile line by line and demonstrates Docker build and run commands.
- Examples
- Uses an OpenJDK 11 image, target/*.jar, app.jar, and tacocloud Docker build and run commands.
- What you can do after
- Operate Docker CLI commands to build an image from a Dockerfile and run the packaged application on port 8080.
Read how Spring in Action, Sixth Edition explains Dockerfile →
Developer Experience on Kubernetes
A Dockerfile is a text file containing instructions for building a container image.
- How it is used
- Frames Dockerfiles as the packaging workflow for turning application software into container images.
- How deep it goes
- Explains layered caching and a Java packaging pitfall, while stopping short of detailing complete production Dockerfile strategies.
- Examples
- Uses a Java JAR containing libraries and application code, then changes one HTTP endpoint to demonstrate unnecessary layer rebuilding.
- What you can do after
- Evaluate Dockerfile packaging choices by relating content order to image rebuilds, cache reuse, runtime performance, and transfer costs.
Read how Developer Experience on Kubernetes explains Dockerfile →
Machine Learning Platform Engineering
A Dockerfile is a text file containing instructions for building a Docker image and configuring the application environment inside it.
- How it is used
- Packages Python applications and notebook environments into reproducible images for deployment and ML workflows.
- How deep it goes
- Explains Dockerfile instructions, image layers, build arguments, startup behavior, image publishing, and multistage notebook construction.
- Examples
- Uses a Python FastAPI Dockerfile, an Uvicorn entrypoint, Docker build and run commands, and a custom Kubeflow notebook image.
- What you can do after
- Build and run tagged Docker images, publish them to a container registry, and assemble custom Kubeflow notebook images.
Read how Machine Learning Platform Engineering explains Dockerfile →
Quarkus in Action
A Dockerfile is a text-based build specification containing instructions for creating a Docker container image.
- How it is used
- Packages Quarkus applications into Docker or Podman images for cloud-oriented deployment workflows.
- How deep it goes
- Explains generated variants and demonstrates one build and run workflow, without covering Dockerfile instructions exhaustively.
- Examples
- Uses generated JVM, legacy-JAR, native, and native-micro files plus a complete native-micro build-and-run listing.
- What you can do after
- Builds and runs a Quarkus native container image with Maven, Docker build, and Docker run commands.
gRPC Microservices in Go
A Dockerfile is a text-based build specification containing instructions for creating a Docker image.
- How it is used
- Defines service images for Docker Compose tests, local development, and Kubernetes deployment.
- How deep it goes
- Explains multistage Go builds, build context, executable transfer, and image commands, while deferring detailed multistage-build treatment.
- Examples
- Uses separate Order and Payment Dockerfiles with Go builder stages, scratch runtimes, Docker Compose services, and docker build commands.
- What you can do after
- Build service images from Dockerfiles and prepare them for Compose-based tests or Kubernetes deployment.
Also covered in
- Server-Side WebAssembly
- Elixir in Action, Third Edition
- AI Agents in Action, Second Edition
- Pro ASP.NET Core 7, Tenth Edition
- Shipping Go: Develop, deliver, discuss, design, and go again
- Claude at WorkIn early access (MEAP)
- Essential TypeScript 5, Third Edition
- Platform Engineering on Kubernetes
- Fight Fraud with Machine LearningIn early access (MEAP)
- Amazon Web Services in Action, Third Edition: An in-depth guide to AWS
- Hugging Face in Action
- Pro Angular 16
What to know first
- containerA software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
- deployment pipelineA deployment pipeline is a repeatable sequence of stages that builds, tests or validates, packages, and delivers software changes toward release or deployment.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- contractA contract is an agreed specification of the conditions, expectations, rights, or obligations that govern behavior or interactions between parties or software components.
Related concepts
- container imageproduces · A container image is a packaged filesystem and metadata artifact from which a container can be created and run.
- image layerproduces · An image layer is an immutable filesystem change set that contributes to a layered container image and may be stored, cached, or shared independently.
- Dockerconfigures · Docker is a platform and toolset for building, distributing, and running applications in containers.
- containerconfigures · A software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
- base imageuses · A base image is a container image that supplies the initial filesystem and environment from which another container image is built.
- CMD instructionhas part · The Dockerfile CMD instruction specifies the default command or arguments for a container started from an image, which can be overridden at runtime.
Questions about Dockerfile
What is Dockerfile?
A Dockerfile is a text file containing instructions for building a Docker container image.
Which Manning books explain Dockerfile?
Learn Docker in a Month of Lunches, Second Edition, Build Python Web Apps with Streamlit, Road to Kubernetes, Rust Servers, Services, and Apps, Kubernetes for Developers, Google Anthos in Action, Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform, Build Financial Software with Generative AI (From Scratch) and 13 more.
What should I know before learning Dockerfile?
Manning books that teach Dockerfile usually introduce container, deployment pipeline, Python and contract first.
What are the parts of Dockerfile?
Dockerfile includes CMD instruction.
What is Dockerfile also called?
Dockerfile is also called Docker file.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




















