1
0
mirror of https://github.com/docker/docs.git synced 2026-10-23 18:09:02 +03:00
Files
docs/content/reference/compose-file/models.md
David Karlsson d511fb5636 docs: move AI Compose and MCP docs into product sections (#26180)
Baby step towards cleaning up the sidenav for the ai/agents section.

<img width="306" height="304" alt="image"
src="https://github.com/user-attachments/assets/57ebd1df-9c7f-4ee8-a84f-a61ffec2cd90"
/>


Moves “Use AI models in Compose” into Compose → How-tos and MCP Catalog
and Toolkit into Docker Desktop → Features and capabilities, removing
both entries from the top-level AI and agents sidebar group.

Updates internal source links and preserves existing public URLs. Scoped
lint and a Hugo build passed; rendered sidebar ancestry, MCP page URLs,
and images were checked locally.

Generated by Codex
2026-09-25 11:42:07 +02:00

1.9 KiB

title, description, keywords, weight
title description keywords weight
Models Learn about the models top-level element compose, compose specification, models, compose file reference 120

{{< summary-bar feature_name="Compose models" >}}

The top-level models section declares AI models that are used by your Compose application. These models are typically pulled as OCI artifacts, run by a model runner, and exposed as an API that your service containers can consume.

Services can only access models when explicitly granted by a models attribute within the services top-level element.

Examples

Example 1

services:
  app:
    image: app
    models:
      - ai_model


models:
  ai_model:
    model: ai/model

In this basic example:

  • The app service uses the ai_model.
  • The ai_model is defined as an OCI artifact (ai/model) that is pulled and served by the model runner.
  • Docker Compose injects connection info, for example AI_MODEL_URL, into the container.

Example 2

services:
  app:
    image: app
    models:
      my_model:
        endpoint_var: MODEL_URL

models:
  my_model:
    model: ai/model
    context_size: 1024
    runtime_flags: 
      - "--a-flag"
      - "--another-flag=42"

In this advanced setup:

  • The service app references my_model using the long syntax.
  • Compose injects the model runner's URL as the environment variable MODEL_URL.

Attributes

  • model (required): The OCI artifact identifier for the model. This is what Compose pulls and runs via the model runner.
  • context_size: Defines the maximum token context size for the model.
  • runtime_flags: A list of raw command-line flags passed to the inference engine when the model is started.

Additional resources

For more examples and information on using model, see Use AI models in Compose