-
Notifications
You must be signed in to change notification settings - Fork 24
docs: add LLM Models example entry #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mathieu-benoit
merged 2 commits into
score-spec:main
from
Abhishek9639:add-llm-models-example
Apr 24, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| --- | ||
| title: "LLM Models with Docker Model Runner" | ||
| description: "How to deploy local LLM models with Open WebUI and Docker Model Runner using `score-compose`" | ||
| headless: true | ||
| toc_hide: true | ||
| --- | ||
|
|
||
| To begin, follow the [installation instructions](/docs/score-implementation/score-compose/installation) to install the latest version of `score-compose`. | ||
|
|
||
| {{% alert title="Prerequisites" %}} | ||
| Docker Model Runner (DMR) needs to be set up in your local environment. Follow the [DMR get started guide](https://docs.docker.com/model-runner/get-started/) to set it up. | ||
| {{% /alert %}} | ||
|
|
||
| ## `init` | ||
|
|
||
| Initialize your current `score-compose` workspace with the Docker Model Runner provisioner. Run the following command in your terminal: | ||
|
|
||
| ```bash | ||
| score-compose init --no-sample \ | ||
| --provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/llm-model/score-compose/10-dmr-llm-model.provisioners.yaml | ||
| ``` | ||
|
|
||
| The `init` command will create the `.score-compose` directory with the [default resource provisioners]({{< relref "/docs/score-implementation/score-compose/resources-provisioners/" >}}) available, plus the Docker Model Runner-specific provisioner for the `llm-model` resource type. | ||
|
|
||
| You can see the resource provisioners available by running this command: | ||
|
|
||
| ```bash | ||
| score-compose provisioners list | ||
| ``` | ||
|
|
||
| The Score file example illustrated uses two resource types: `llm-model` and `volume`. | ||
|
|
||
| ```none | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | TYPE | CLASS | PARAMS | OUTPUTS | DESCRIPTION | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | llm-model | (any) | model | url | Provisions an LLM model via | | ||
| | | | | | Docker Model Runner | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | volume | (any) | | source, type | Creates a persistent volume | | ||
| | | | | | that can be mounted on a | | ||
| | | | | | workload. | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| ``` | ||
|
|
||
| ## `generate` | ||
|
|
||
| Convert the `score.yaml` file into a deployable `compose.yaml`. Run the following command in your terminal: | ||
|
|
||
| ```bash | ||
| score-compose generate score.yaml \ | ||
| --image ghcr.io/open-webui/open-webui:main-slim \ | ||
| --publish 8080:open-webui:8080 \ | ||
| --override-property containers.open-webui.variables.WEBUI_NAME="Hello, DMR with Score Compose!" \ | ||
| --output compose.yaml | ||
| ``` | ||
|
|
||
| The `generate` command will add the input `score.yaml` workload with a particular container image to the `.score-compose/state.yaml` state file and generate the output `compose.yaml`. | ||
|
|
||
| The `--publish` flag exposes the Open WebUI port to the host so you can access it in your browser. | ||
|
|
||
| See the generated `compose.yaml` by running this command: | ||
|
|
||
| ```bash | ||
| cat compose.yaml | ||
| ``` | ||
|
|
||
| If you make any modifications to the `score.yaml` file, run `score-compose generate score.yaml` to regenerate the output `compose.yaml`. | ||
|
|
||
| ## `docker compose` | ||
|
|
||
| Run `docker compose up` to execute the generated `compose.yaml` file: | ||
|
|
||
| ```bash | ||
| docker compose up -d --wait | ||
| ``` | ||
|
|
||
| This will pull the requested LLM models (`ai/gemma3:270M-UD-IQ2_XXS` and `ai/smollm2:135M-Q2_K`) via Docker Model Runner, and then start the Open WebUI container connected to the DMR backend. | ||
|
|
||
| ## Verify | ||
|
|
||
| Check the Docker images, including the LLM model images pulled by Docker Model Runner: | ||
|
|
||
| ```bash | ||
| docker images | ||
| ``` | ||
|
|
||
| ```none | ||
| REPOSITORY TAG SIZE | ||
| open-webui main-slim ... | ||
| ai/gemma3 270M-UD-IQ2_XXS 182MB | ||
| ai/smollm2 135M-Q2_K 56.9MB | ||
| ``` | ||
|
|
||
| See the running containers: | ||
|
|
||
| ```bash | ||
| docker ps | ||
| ``` | ||
|
|
||
| You should see the `open-webui` container running and connected to the Docker Model Runner backend. | ||
|
|
||
| ## Access Open WebUI | ||
|
|
||
| Open your browser and navigate to [http://localhost:8080](http://localhost:8080) to access the Open WebUI frontend. You can now chat with the LLM models you deployed! | ||
|
|
||
| Congrats! You've successfully deployed, with the `score-compose` implementation, local LLM models with Open WebUI and Docker Model Runner. You provisioned them through Docker, without writing the Docker Compose file by yourself. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| --- | ||
| title: "LLM Models with Ollama" | ||
| description: "How to deploy local LLM models with Open WebUI and Ollama using `score-compose`" | ||
| headless: true | ||
| toc_hide: true | ||
| --- | ||
|
|
||
| To begin, follow the [installation instructions](/docs/score-implementation/score-compose/installation) to install the latest version of `score-compose`. | ||
|
|
||
| ## `init` | ||
|
|
||
| Initialize your current `score-compose` workspace with the Ollama provisioner and patch template. Run the following command in your terminal: | ||
|
|
||
| ```bash | ||
| score-compose init --no-sample \ | ||
| --patch-templates https://raw.githubusercontent.com/score-spec/community-patchers/refs/heads/main/score-compose/ollama.tpl \ | ||
| --provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/llm-model/score-compose/10-ollama-llm-model-service.provisioners.yaml | ||
| ``` | ||
|
|
||
| The `init` command will create the `.score-compose` directory with the [default resource provisioners]({{< relref "/docs/score-implementation/score-compose/resources-provisioners/" >}}) available, plus the Ollama-specific provisioner for the `llm-model` resource type. | ||
|
|
||
| The `--patch-templates` option adds the [`ollama.tpl`](https://github.com/score-spec/community-patchers/blob/main/score-compose/ollama.tpl) patch template which configures the Ollama service integration in the generated Docker Compose file. | ||
|
|
||
| You can see the resource provisioners available by running this command: | ||
|
|
||
| ```bash | ||
| score-compose provisioners list | ||
| ``` | ||
|
|
||
| The Score file example illustrated uses two resource types: `llm-model` and `volume`. | ||
|
|
||
| ```none | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | TYPE | CLASS | PARAMS | OUTPUTS | DESCRIPTION | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | llm-model | (any) | model | url | Provisions an LLM model via | | ||
| | | | | | Ollama | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| | volume | (any) | | source, type | Creates a persistent volume | | ||
| | | | | | that can be mounted on a | | ||
| | | | | | workload. | | ||
| +---------------+-------+--------+--------------------+---------------------------------+ | ||
| ``` | ||
|
|
||
| ## `generate` | ||
|
|
||
| Convert the `score.yaml` file into a deployable `compose.yaml`. Run the following command in your terminal: | ||
|
|
||
| ```bash | ||
| score-compose generate score.yaml \ | ||
| --image ghcr.io/open-webui/open-webui:main-slim \ | ||
| --publish 8080:open-webui:8080 \ | ||
| --override-property containers.open-webui.variables.WEBUI_NAME="Hello, Ollama with Score Compose!" \ | ||
| --output compose.yaml | ||
| ``` | ||
|
|
||
| The `generate` command will add the input `score.yaml` workload with a particular container image to the `.score-compose/state.yaml` state file and generate the output `compose.yaml`. | ||
|
|
||
| The `--publish` flag exposes the Open WebUI port to the host so you can access it in your browser. | ||
|
|
||
| See the generated `compose.yaml` by running this command: | ||
|
|
||
| ```bash | ||
| cat compose.yaml | ||
| ``` | ||
|
|
||
| If you make any modifications to the `score.yaml` file, run `score-compose generate score.yaml` to regenerate the output `compose.yaml`. | ||
|
|
||
| ## `docker compose` | ||
|
|
||
| Run `docker compose up` to execute the generated `compose.yaml` file: | ||
|
|
||
| ```bash | ||
| docker compose up -d --wait | ||
| ``` | ||
|
|
||
| This will pull the Ollama container image, start the Ollama service, pull the requested LLM models (`gemma3:270m` and `smollm2:135m`), and then start the Open WebUI container connected to the Ollama backend. | ||
|
|
||
| ## Verify | ||
|
|
||
| Check the Docker images that were pulled: | ||
|
|
||
| ```bash | ||
| docker images | ||
| ``` | ||
|
|
||
| ```none | ||
| REPOSITORY TAG SIZE | ||
| ollama/ollama latest 3.33GB | ||
| open-webui main-slim ... | ||
| ``` | ||
|
|
||
| Check that the LLM models were successfully pulled by Ollama: | ||
|
|
||
| ```bash | ||
| curl localhost:11434/api/tags | jq -r .models[].name | ||
| ``` | ||
|
|
||
| ```none | ||
| gemma3:270m | ||
| smollm2:135m | ||
| ``` | ||
|
|
||
| See the running containers: | ||
|
|
||
| ```bash | ||
| docker ps | ||
| ``` | ||
|
|
||
| You should see the `open-webui` and `ollama` containers running, along with some exited "puller" containers that were used to download the models. | ||
|
|
||
| ## Access Open WebUI | ||
|
|
||
| Open your browser and navigate to [http://localhost:8080](http://localhost:8080) to access the Open WebUI frontend. You can now chat with the LLM models you deployed! | ||
|
|
||
| Congrats! You've successfully deployed, with the `score-compose` implementation, local LLM models with Open WebUI and Ollama. You provisioned them through Docker, without writing the Docker Compose file by yourself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| --- | ||
| title: "LLM Models" | ||
| linkTitle: "LLM Models" | ||
| description: "How to deploy local LLM models with Open WebUI using `score-compose`" | ||
| weight: 8 | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| In this example we will walk you through how you can deploy local LLM models with [Open WebUI](https://github.com/open-webui/open-webui) as the frontend, and this with `score-compose`. We'll cover two approaches to run the LLM models locally: using [Ollama](https://ollama.com/) or using [Docker Model Runner (DMR)](https://docs.docker.com/desktop/features/model-runner/). | ||
|
|
||
| ```mermaid | ||
| flowchart TD | ||
| subgraph Workloads | ||
| open-webui-workload(Open WebUI) | ||
| end | ||
| open-webui-workload-->gemma3[[gemma3 - LLM Model]] | ||
| open-webui-workload-->smollm2[[smollm2 - LLM Model]] | ||
| open-webui-workload-->Volume | ||
| ``` | ||
|
|
||
| ## Score file | ||
|
|
||
| Open your IDE and paste in the following `score.yaml` file, which describes an Open WebUI application that connects to two LLM models (`gemma3` and `smollm2`) and stores its data in a persistent volume. | ||
|
|
||
| For the **Ollama** scenario: | ||
|
|
||
| ```yaml | ||
| apiVersion: score.dev/v1b1 | ||
| metadata: | ||
| name: open-webui | ||
| containers: | ||
| open-webui: | ||
| image: . | ||
| variables: | ||
| OLLAMA_BASE_URL: "${resources.gemma3.url}" | ||
| volumes: | ||
| /app/backend/data: | ||
| source: ${resources.data} | ||
| resources: | ||
| data: | ||
| type: volume | ||
| gemma3: | ||
| type: llm-model | ||
| params: | ||
| model: gemma3:270m | ||
| smollm2: | ||
| type: llm-model | ||
| params: | ||
| model: smollm2:135m | ||
| service: | ||
| ports: | ||
| tcp: | ||
| port: 8080 | ||
| targetPort: 8080 | ||
| ``` | ||
|
|
||
| For the **Docker Model Runner (DMR)** scenario, the `score.yaml` file is almost identical. The key differences are the model names, which follow the DMR naming convention: | ||
|
|
||
| ```yaml | ||
| apiVersion: score.dev/v1b1 | ||
| metadata: | ||
| name: open-webui | ||
| containers: | ||
| open-webui: | ||
| image: . | ||
| variables: | ||
| OLLAMA_BASE_URL: "${resources.smollm2.url}" | ||
| volumes: | ||
| /app/backend/data: | ||
| source: ${resources.data} | ||
| resources: | ||
| data: | ||
| type: volume | ||
| gemma3: | ||
| type: llm-model | ||
| params: | ||
| model: ai/gemma3:270M-UD-IQ2_XXS | ||
| smollm2: | ||
| type: llm-model | ||
| params: | ||
| model: ai/smollm2:135M-Q2_K | ||
| service: | ||
| ports: | ||
| tcp: | ||
| port: 8080 | ||
| targetPort: 8080 | ||
| ``` | ||
|
|
||
| Both files use the `llm-model` resource type to request LLM models. The `score-compose` provisioners handle the underlying infrastructure differences (Ollama container vs Docker Model Runner) transparently. | ||
|
|
||
| ## Deployment with `score-compose` | ||
|
|
||
| From here, we will now see how to deploy this Score file with `score-compose`, using either Ollama or Docker Model Runner as the LLM backend: | ||
|
|
||
| {{< tabs name="deployments">}} | ||
| {{< tab name="Ollama" include="./included/llm-models-ollama.md" />}} | ||
| {{< tab name="Docker Model Runner (DMR)" include="./included/llm-models-dmr.md" />}} | ||
| {{< /tabs >}} | ||
|
|
||
| ## Next steps | ||
|
|
||
| - [**Deep dive with the associated blog post**](https://medium.com/google-cloud/score-docker-compose-to-deploy-your-local-llm-models-10aff89686ce): Go through the associated step-by-step blog post to understand the different concepts in more detail. | ||
| - [**Explore more examples**](/examples/): Check out more examples to dive into further use cases and experiment with different configurations. | ||
| - [**Join the Score community**]({{< relref "/docs/community" >}}): Connect with fellow Score developers on our CNCF Slack channel or start find your way to contribute to Score. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.