liveBook · Manning

Docker Desktop

As explained in AI Agents in Action, Second Edition

Docker Desktop is a desktop application that installs and manages Docker container development and runtime components.

Docker Desktop is a local desktop application for building, running, and managing containerized agent services. It provides a practical bridge between an application folder and a running container. section 8.2.1 section 8.2

A Dockerfile defines the container setup; Docker builds an image from it, while Docker Desktop helps operate the resulting containers. Local Docker Desktop use contrasts with larger deployments using Kubernetes or cloud platforms. section 8.2.1 section 8.2

A practical Docker Desktop workflow is:

  • Place the generated Dockerfile beside the application. section 8.2.1
  • Build an image with docker build, then run it with a port mapping and required API key. section 8.2.1
  • Assign a container name when you want to start, stop, inspect, and manage it from Docker Desktop. section 8.2.1
  • Use Docker Compose when the web UI, voice agent, and image agent must run as one stack. section 8.5

Run an image-generation API

Build image-generator:latest from the application directory, then run it on local port 8000 with OPENAI_API_KEY supplied as an environment variable. Rerun it as image-gen when you want to manage the container through Docker Desktop and observe its logs. section 8.2.1 section 8.5

Listing 8.4 Dockerfile and generation prompt
{copy the Python web API or MCP code above}
Prompt: Generate a Dockerfile that containerizes the above application. The above application is called 02_app.py.    #1

FROM python:3.11-slim    #2

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PORT=8000

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential curl ca-certificates && \
    rm -rf /var/lib/apt/lists/*    #3

COPY requirements.txt /app/requirements.txt    #4
RUN if [ -f /app/requirements.txt ]; then \
    pip install --no-cache-dir -r /app/requirements.txt; \
    else \
    pip install --no-cache-dir "uvicorn[standard]" fastapi; \
    fi

COPY . /app

EXPOSE ${PORT}    #5
CMD ["sh", "-c", "uvicorn 02_app:app --host 0.0.0.0 --port ${PORT}"]

Inspect the Dockerfile-generation prompt and the resulting Python 3.11 container definition, including dependencies, port exposure, and the Uvicorn command. section 8.2.1

How AI Agents in Action, Second Edition covers it

How deep it goes
Demonstrates Dockerfile creation, image building, container execution, naming, interface management, and logging, but defers enterprise deployment.
Examples
Uses an image-generation API, named image-gen container, Dockerfile listing, Docker commands, and a multi-agent Compose stack.
What it assumes
Assumes an application, Dockerfile, and API key; teaches installation, image building, container execution, and local management.
What you can do after
Operate/configure a local agent container, test its API, manage its lifecycle, and inspect logs through Docker Desktop.
How it connects
Connects Docker Desktop with Dockerfiles, containers, Docker Compose, APIs, MCP servers, and Kubernetes.

Also explained in

Compare how 3 books explain Docker Desktop →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.