A base image gives a new Docker image its initial filesystem and runtime environment. Instead of configuring a generic Ubuntu container from zero, start with an image such as Python, Ruby, or httpd that already supplies the relevant environment. section 2.1.4
A base image is itself built with a Dockerfile and may inherit from another base image. This chain can continue until scratch, an empty starting container. Choose the image that eliminates the most configuration, then add application dependencies, copy the application, and define how it runs. section 2.1.4 section 2.2.1
Choose a base image by considering the work it removes and the maintenance it creates:
- Prefer a language or framework image when it matches the application: use python for Django, ruby for Rails, and a suitable server image for Apache. section 2.1.4 section 2.2.1
- Search existing Dockerfile examples before building from scratch; public images and examples can provide a substantial starting point for common environments. section 2.1.4 section 2.2.1
- Rebuild containers when base-image vulnerabilities are fixed, and select a version tag deliberately: a minor version can receive patches while reducing unexpected feature changes. section 12.1.2
Python application image
A small Python image can begin with FROM python:3, copy the application into /app, and set /app as the working directory. An HTTP server can use FROM python:3.12, add its application-specific settings, and run with Docker port forwarding.






