Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ input[type="search"]::-ms-clear {
.navbar-group:first-of-type {
margin-top: 0.2rem !important;
}

#search-page-results {
mark:where(.dark, .dark *) {
color: var(--color-blue-400);
}
}
4 changes: 4 additions & 0 deletions assets/css/utilities.css
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,7 @@
@utility chip {
@apply border-divider-light dark:border-divider-dark inline-flex items-center gap-1 rounded-full border bg-gray-100 px-2 text-sm text-gray-800 select-none dark:bg-gray-700 dark:text-gray-200;
}

@utility pagination-link {
@apply flex items-center justify-center rounded-sm p-2;
}
9 changes: 9 additions & 0 deletions content/manuals/ai/compose/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
build:
render: never
title: AI and Docker Compose
weight: 40
params:
sidebar:
group: AI
---
184 changes: 184 additions & 0 deletions content/manuals/ai/compose/models-and-compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
title: Define AI Models in Docker Compose applications
linkTitle: Use AI models in Compose
description: Learn how to define and use AI models in Docker Compose applications using the models top-level element
keywords: compose, docker compose, models, ai, machine learning, cloud providers, specification
weight: 10
params:
sidebar:
badge:
color: green
text: New
---

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

Compose lets you define AI models as core components of your application, so you can declare model dependencies alongside services and run the application on any platform that supports the Compose Specification.

## Prerequisites

- Docker Compose v2.38 or later
- A platform that supports Compose models such as Docker Model Runner or compatible cloud providers

## What are Compose models?

Compose `models` are a standardized way to define AI model dependencies in your application. By using the []`models` top-level element](/reference/compose-file/models.md) in your Compose file, you can:

- Declare which AI models your application needs
- Specify model configurations and requirements
- Make your application portable across different platforms
- Let the platform handle model provisioning and lifecycle management

## Basic model definition

To define models in your Compose application, use the `models` top-level element:

```yaml
services:
chat-app:
image: my-chat-app
models:
- llm

models:
llm:
image: ai/smollm2
```

This example defines:
- A service called `chat-app` that uses a model named `llm`
- A model definition for `llm` that references the `ai/smollm2` model image

## Model configuration options

Models support various configuration options:

```yaml
models:
llm:
image: ai/smollm2
context_size: 1024
runtime_flags:
- "--a-flag"
- "--another-flag=42"
```

Common configuration options include:
- `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.
- Platform-specific options may also be available via extensions attributes `x-*`

## Service model binding

Services can reference models in two ways: short syntax and long syntax.

### Short syntax

The short syntax is the simplest way to bind a model to a service:

```yaml
services:
app:
image: my-app
models:
- llm
- embedding-model

models:
llm:
image: ai/smollm2
embedding-model:
image: ai/all-minilm
```

With short syntax, the platform automatically generates environment variables based on the model name:
- `LLM_URL` - URL to access the llm model
- `LLM_MODEL` - Model identifier for the llm model
- `EMBEDDING_MODEL_URL` - URL to access the embedding-model
- `EMBEDDING_MODEL_MODEL` - Model identifier for the embedding-model

### Long syntax

The long syntax allows you to customize environment variable names:

```yaml
services:
app:
image: my-app
models:
llm:
endpoint_var: AI_MODEL_URL
model_var: AI_MODEL_NAME
embedding-model:
endpoint_var: EMBEDDING_URL
model_var: EMBEDDING_NAME

models:
llm:
image: ai/smollm2
embedding-model:
image: ai/all-minilm
```

With this configuration, your service receives:
- `AI_MODEL_URL` and `AI_MODEL_NAME` for the LLM model
- `EMBEDDING_URL` and `EMBEDDING_NAME` for the embedding model

## Platform portability

One of the key benefits of using Compose models is portability across different platforms that support the Compose specification.

### Docker Model Runner

When Docker Model Runner is enabled:

```yaml
services:
chat-app:
image: my-chat-app
models:
- llm

models:
llm:
image: ai/smollm2
```

Docker Model Runner will:
- Pull and run the specified model locally
- Provide endpoint URLs for accessing the model
- Inject environment variables into the service

### Cloud providers

The same Compose file can run on cloud providers that support Compose models:

```yaml
services:
chat-app:
image: my-chat-app
models:
- llm

models:
llm:
image: ai/smollm2
# Cloud-specific configurations
labels:
- "cloud.instance-type=gpu-small"
- "cloud.region=us-west-2"
```

Cloud providers might:
- Use managed AI services instead of running models locally
- Apply cloud-specific optimizations and scaling
- Provide additional monitoring and logging capabilities
- Handle model versioning and updates automatically

## Reference

- [`models` top-level element](/reference/compose-file/models.md)
- [`models` attribute](/reference/compose-file/services.md#models)
- [Docker Model Runner documentation](/manuals/ai/model-runner.md)
- [Compose Model Runner documentation](/manuals/compose/how-tos/model-runner.md)]
18 changes: 10 additions & 8 deletions content/manuals/compose/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ title: Docker Compose
weight: 30
description: Learn how to use Docker Compose to define and run multi-container applications
with this detailed introduction to the tool.
keywords: docker compose, docker-compose, docker compose command, docker compose files,
docker compose documentation, using docker compose, compose container, docker compose
service
keywords: docker compose, docker-compose, compose.yaml, docker compose command, multi-container applications, container orchestration, docker cli
params:
sidebar:
group: Open source
Expand Down Expand Up @@ -36,6 +34,10 @@ grid:
Docker application.
icon: polyline
link: /reference/compose-file
- title: Use Compose Bridge
description: Transform your Compose configuration file into configuration files for different platforms, such as Kubernetes.
icon: move_down
link: /compose/bridge
- title: Browse common FAQs
description: Explore general FAQs and find out how to give feedback.
icon: help
Expand All @@ -58,12 +60,12 @@ It is the key to unlocking a streamlined and efficient development and deploymen
Compose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single YAML configuration file. Then, with a single command, you create and start all the services
from your configuration file.

Compose works in all environments; production, staging, development, testing, as
Compose works in all environments - production, staging, development, testing, as
well as CI workflows. It also has commands for managing the whole lifecycle of your application:

* Start, stop, and rebuild services
* View the status of running services
* Stream the log output of running services
* Run a one-off command on a service
- Start, stop, and rebuild services
- View the status of running services
- Stream the log output of running services
- Run a one-off command on a service

{{< grid >}}
14 changes: 0 additions & 14 deletions content/manuals/compose/bridge/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ Compose Bridge provides its own transformation for Kubernetes using Go templates

For more detailed information on how these transformations work and how you can customize them for your projects, see [Customize](customize.md).

## Setup

To get started with Compose Bridge, you need to:

1. Download and install Docker Desktop version 4.33 and later.
2. Sign in to your Docker account.
3. Navigate to the **Beta features** tab in **Settings**.
4. Select **Enable Compose Bridge**.
5. Select **Apply & restart**.

## Feedback

To give feedback, report bugs, or receive support, email `desktop-preview@docker.com`. There is also a dedicated Slack channel. To join, simply send an email to the provided address.

## What's next?

- [Use Compose Bridge](usage.md)
Expand Down
2 changes: 1 addition & 1 deletion content/manuals/compose/gettingstarted.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Check out this tutorial on how to use Docker Compose from defining application
description: Follow this hands-on tutorial to learn how to use Docker Compose from defining application
dependencies to experimenting with commands.
keywords: docker compose example, docker compose tutorial, how to use docker compose,
running docker compose, how to run docker compose, docker compose build image, docker
Expand Down
10 changes: 4 additions & 6 deletions content/manuals/compose/install/_index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
description: Learn how to install Docker Compose. Compose is available natively on
Docker Desktop, as a Docker Engine plugin, and as a standalone tool.
keywords: install docker compose, docker compose install, install docker compose ubuntu,
installing docker compose, docker compose download, docker compose not found, docker
compose windows, how to install docker compose
keywords: install docker compose, docker compose plugin, install compose linux, install docker desktop, docker compose windows, standalone docker compose, docker compose not found
title: Overview of installing Docker Compose
linkTitle: Install
weight: 20
Expand All @@ -18,7 +16,7 @@ This page summarizes the different ways you can install Docker Compose, dependin

## Installation scenarios

### Scenario one: Install Docker Desktop (Recommended)
### Docker Desktop (Recommended)

The easiest and recommended way to get Docker Compose is to install Docker Desktop.

Expand All @@ -33,7 +31,7 @@ Docker Desktop is available for:
>
> If you have already installed Docker Desktop, you can check which version of Compose you have by selecting **About Docker Desktop** from the Docker menu {{< inline-image src="../../desktop/images/whale-x.svg" alt="whale menu" >}}.

### Scenario two: Install the Docker Compose plugin (Linux only)
### Plugin (Linux only)

> [!IMPORTANT]
>
Expand All @@ -43,7 +41,7 @@ If you already have Docker Engine and Docker CLI installed, you can install the
- [Using Docker's repository](linux.md#install-using-the-repository)
- [Downloading and installing manually](linux.md#install-the-plugin-manually)

### Scenario three: Install the Docker Compose standalone (Legacy)
### Standalone (Legacy)

> [!WARNING]
>
Expand Down
18 changes: 9 additions & 9 deletions content/manuals/compose/install/linux.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
---
description: Download and install Docker Compose on Linux with this step-by-step handbook.
This plugin can be installed manually or by using a repository.
keywords: install docker compose linux, docker compose linux, docker compose plugin,
docker-compose-plugin, linux install docker compose, install docker-compose linux,
linux install docker-compose, linux docker compose, docker compose v2 linux, install
docker compose on linux
description: Step-by-step instructions for installing the Docker Compose plugin on Linux using a package repository or manual method.
keywords: install docker compose linux, docker compose plugin, docker-compose-plugin linux, docker compose v2, docker compose manual install, linux docker compose
toc_max: 3
title: Install the Docker Compose plugin
linkTitle: Plugin
Expand Down Expand Up @@ -77,9 +73,9 @@ To update the Docker Compose plugin, run the following commands:

## Install the plugin manually

> [!IMPORTANT]
> [!WARNING]
>
> This option requires you to manage upgrades manually. It is recommended that you set up Docker's repository for easier maintenance.
> Manual installations don’t auto-update. For ease of maintenance, use the Docker repository method.

1. To download and install the Docker Compose CLI plugin, run:

Expand Down Expand Up @@ -113,4 +109,8 @@ To update the Docker Compose plugin, run the following commands:
```console
$ docker compose version
```


## What's next?

- [Understand how Compose works](/manuals/compose/intro/compose-application-model.md)
- [Try the Quickstart guide](/manuals/compose/gettingstarted.md)
12 changes: 9 additions & 3 deletions content/manuals/compose/install/standalone.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Install the Docker Compose standalone
linkTitle: Standalone
description: How to install Docker Compose - Other Scenarios
keywords: compose, orchestration, install, installation, docker, documentation
description: Instructions for installing the legacy Docker Compose standalone tool on Linux and Windows Server
keywords: install docker-compose, standalone docker compose, docker-compose windows server, install docker compose linux, legacy compose install
toc_max: 3
weight: 20
---
Expand All @@ -12,7 +12,8 @@ This page contains instructions on how to install Docker Compose standalone on L
> [!WARNING]
>
> The Docker Compose standalone uses the `-compose` syntax instead of the current standard syntax `compose`.
> For example, you must type `docker-compose up` when using Docker Compose standalone, instead of `docker compose up`.
> For example, you must type `docker-compose up` when using Docker Compose standalone, instead of `docker compose up`.
> Use it only for backward compatibility.

## On Linux

Expand Down Expand Up @@ -74,3 +75,8 @@ on Microsoft Windows Server](/manuals/engine/install/binaries.md#install-server-
$ docker-compose.exe version
Docker Compose version {{% param "compose_version" %}}
```

## What's next?

- [Understand how Compose works](/manuals/compose/intro/compose-application-model.md)
- [Try the Quickstart guide](/manuals/compose/gettingstarted.md)
Loading