A container image is a read-only template containing the filesystem, application code, and dependencies used to create containers. Docker lets developers run packaged technologies without installing them directly on their machines. section 3.2.3 section 12.2.1
Images can come from an existing base image or be assembled with a Dockerfile. The Dockerfile records the starting image, copied files, build-time installation commands, and default startup command. section 3.2.3
A Dockerfile commonly uses these instructions:
- FROM selects the base image, optionally using a tag to lock a version. section 3.2.3
- COPY transfers local files, such as a requirements.txt file, into the image. section 3.2.3
- RUN executes installation or setup commands while the image is built. section 3.2.3
- CMD defines the default process started when a container runs from the image. section 3.2.3
FastAPI API image
A Python API image can start from the standard Docker Python image, copy dependency definitions, install FastAPI and related packages, and use CMD to launch Uvicorn. Docker Compose then references the Dockerfile when creating the API container. section 3.2.3
Image selection affects maintenance and security. Smaller or less unnecessary images can reduce wasted space, improve security, and support faster deployment; development may use latest, while production version changes require more care around deprecated features, bugs, and vulnerabilities. section 3.2.3 section 3.6
























