liveBook · Manning

Container image

As explained in Build Financial Software with Generative AI (From Scratch)

A Docker image is a read-only package containing the filesystem, application code, and dependencies used to create containers.

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

How Build Financial Software with Generative AI (From Scratch) covers it

How deep it goes
Explains read-only templates, Dockerfile instructions, version tags, optimization, and security concerns without descending into image internals.
Examples
Uses a Python FastAPI API image, Docker Compose services, Postgres, WSO2 API Manager, and disposable images for exploring technologies.
What you can do after
Build it from scratch with a Dockerfile, select a base image and tag, install dependencies, start an API, and remove unnecessary components.
How it connects
Connects container images with Docker containers, Dockerfiles, Docker Compose, FastAPI, Python, Uvicorn, and image optimization.

Also explained in

Compare how 25 books explain container image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Financial Software with Generative AI (From Scratch). The section links point to the parts of the book it draws on.