liveBook · Manning

Dockerfile

As explained in Distributed Machine Learning Patterns

A Dockerfile is a declarative text file containing instructions for building a Docker container image.

A Dockerfile declaratively packages the software needed to run distributed model training. The image can serve as the common runtime for worker Pods and later workflow steps. section 9.2.2

A practical containerization workflow uses the Dockerfile to:

  • Start from the Python 3.9 base image. section 9.2.2
  • Copy the distributed-training script, then rebuild and re-import the image when additional workflow scripts are added. section 9.4.1

Distributed-training image

FROM python:3.9 RUN pip install tensorflow==2.11.0 tensorflow_datasets==4.7.0 COPY multi-worker-distributed-training.py /

The Dockerfile supplies the executable environment, while Kubernetes volumes preserve trained models and checkpoints after worker Pods are deleted. Treat image contents and persistent storage as separate deployment concerns. section 9.2.2

How Distributed Machine Learning Patterns covers it

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 it assumes
Assumes familiarity with Python scripts, pip packages, Docker image commands, and Kubernetes-based distributed training.
What you can do after
Builds and imports a tagged training image for execution in a local k3d Kubernetes cluster.
How it connects
Connects container images with TensorFlow, Kubernetes, k3d, Kubeflow, workflow steps, and persistent volumes.

Also explained in

Compare how 18 books explain Dockerfile →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Distributed Machine Learning Patterns. The section links point to the parts of the book it draws on.