Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
373 commits
Select commit Hold shift + click to select a range
b4649d8
[AIE-186] Add detection of Model Runner context
xenoscopic May 9, 2025
771b747
Update desktop/context.go
xenoscopic May 12, 2025
89439ba
Update desktop/context.go
xenoscopic May 12, 2025
de1791b
nit: fix formatting from suggestion
xenoscopic May 12, 2025
50cdbb8
tests: fix mocks and unit tests for context detection
xenoscopic May 12, 2025
2d44164
Merge pull request #50 from docker/context-detection
xenoscopic May 12, 2025
138bd11
Add `docker model install-runner`
doringeman May 8, 2025
649f613
Add `docker model uninstall-runner`
doringeman May 8, 2025
fbd8326
commands: rename install-runner.go for consistency
xenoscopic May 12, 2025
e9a51a3
install: restrict platforms on which installation is supported
xenoscopic May 12, 2025
6608b16
install: use CLI to construct Docker API client
xenoscopic May 12, 2025
43d44f7
install: make non-GPU install the default
xenoscopic May 12, 2025
a153aba
install: switch to JSONMessage type for status updates
xenoscopic May 12, 2025
afbfce1
install: use strong typing for port argument
xenoscopic May 12, 2025
cd0a1f4
Add `docker model package` command
ekcasey May 12, 2025
c460fc7
Adds version to user agent when interacting with registry
ekcasey May 12, 2025
90580b9
Merge pull request #52 from docker/package
xenoscopic May 12, 2025
8267c5a
install: switch to final image name / tags
xenoscopic May 12, 2025
6c02d7f
install: extract common definitions and fix image names
xenoscopic May 12, 2025
0fa176c
install: refactor and extract install code into standalone package
xenoscopic May 12, 2025
493bbe9
install: auto-invoke install-runner when required
xenoscopic May 13, 2025
1c5211e
compose: enable support for standalone installs
xenoscopic May 13, 2025
b46d23c
all: rename DMR_HOST to MODEL_RUNNER_HOST
xenoscopic May 13, 2025
645488c
nit: avoid Printf whenever possible
xenoscopic May 13, 2025
670ef98
nit: wrap errors
xenoscopic May 13, 2025
8a49b0a
uninstall: simplify image removal error handling
xenoscopic May 13, 2025
d03c38f
compose: fix support for new context awareness
xenoscopic May 13, 2025
a1eb68d
compose: fix formatting verb
xenoscopic May 13, 2025
39729dd
Update commands/uninstall-runner.go
xenoscopic May 13, 2025
430b784
uninstall: use image name constants and clarify uninstall behavior
xenoscopic May 13, 2025
7119eae
Merge pull request #48 from doringeman/install-runner
xenoscopic May 13, 2025
07ebe11
add array of model support to compose provider commands
glours May 13, 2025
32289c3
Merge pull request #53 from glours/compose-provider-model-array
xenoscopic May 13, 2025
9439c31
standalone: use host.docker.internal for Compose on Moby and Cloud
xenoscopic May 13, 2025
1107b13
Fixes error formatting output from package command
ekcasey May 13, 2025
d927555
Merge pull request #54 from docker/fix-output
ekcasey May 13, 2025
f03cade
standalone: implement docker model logs
xenoscopic May 13, 2025
c94ac96
Update commands/compose.go
xenoscopic May 13, 2025
1926c51
Merge pull request #55 from docker/standalone-refinement
xenoscopic May 13, 2025
537ca41
context: properly handle query parameters in URLs
xenoscopic May 13, 2025
4040058
standalone: use nvidia runtime if using GPU
xenoscopic May 13, 2025
16bdda8
Merge pull request #56 from docker/query-param-fix
xenoscopic May 13, 2025
c7ce30b
Merge pull request #57 from docker/nvidia-runtime
xenoscopic May 13, 2025
3b4c8c8
cli: fix autocompletion to work with context detection
xenoscopic May 14, 2025
a88568f
Merge pull request #58 from docker/fix-completion
xenoscopic May 14, 2025
d5723e4
cloud: Move Cloud install logic into Model CLI and add GPU detection
xenoscopic May 14, 2025
8a2f1e8
standalone: modify bindings to ensure bridge network listening
xenoscopic May 14, 2025
ed8cbd2
standalone: display install progress in list if safe to do
xenoscopic May 14, 2025
0f98703
standalone: refine readiness probing
xenoscopic May 14, 2025
31d580b
standalone: attach service labels to model storage volumes
xenoscopic May 14, 2025
9b343e2
standalone: make logs work with Docker Cloud
xenoscopic May 14, 2025
f1c3d1c
standalone: prune stopped mode runners before searching
xenoscopic May 15, 2025
3f51f21
Merge pull request #59 from docker/cloud-unification
xenoscopic May 15, 2025
cbf0d0b
Merge pull request #60 from docker/list-install-status
xenoscopic May 15, 2025
1e35209
standalone: use different default port for Cloud installs
xenoscopic May 15, 2025
102489b
Merge pull request #61 from docker/cloud-default-port
xenoscopic May 15, 2025
b85ea46
generate reference docs with cli-docs-tool (#62)
crazy-max May 21, 2025
092732a
Add `docker model ps`
doringeman May 20, 2025
0c822e6
Add `docker model ps`
doringeman May 20, 2025
10da2cb
Add `docker model df`
doringeman May 21, 2025
3fd3abc
Add `docker model unload`
doringeman May 21, 2025
d7d9789
Update docs
doringeman May 21, 2025
69d2009
Merge pull request #63 from doringeman/ps
doringeman May 21, 2025
cb54223
Add `docker model df`
doringeman May 21, 2025
bfe1204
Merge pull request #64 from doringeman/df
doringeman May 21, 2025
729ee30
Add `docker model unload`
doringeman May 21, 2025
b138cde
Merge pull request #65 from doringeman/unload
doringeman May 21, 2025
7ea6337
Merge pull request #67 from doringeman/fix-docs
doringeman May 21, 2025
f577662
docs: update dmr cmds
ArthurFlag May 21, 2025
c19f7f0
ci: fix missing pull_request event
crazy-max May 21, 2025
50a3679
Merge pull request #68 from crazy-max/ci-fix-missing-pr-event
xenoscopic May 21, 2025
36641c6
Update docs/reference/model.md
ArthurFlag May 22, 2025
b566aff
feedback
ArthurFlag May 22, 2025
4145443
unload: fix all command without model specified
xenoscopic May 23, 2025
94e7f9e
Merge pull request #71 from docker/fix-unload-all-panic
xenoscopic May 23, 2025
e0ba13e
Merge service and runtime logs
May 23, 2025
fac32dc
Merge pull request #69 from ArthurFlag/update-dmr-docs
xenoscopic May 27, 2025
a2927b7
Use int64 to represent byte sizes
May 26, 2025
b82ff6d
Allow unloading multiple models at once
May 26, 2025
27ccea9
Add `--do-not-track` to disable the metrics tracker
doringeman May 28, 2025
29629ec
Merge pull request #75 from doringeman/metrics
doringeman Jun 5, 2025
75be694
install-runner: Document both default ports for Moby and Cloud
doringeman Jun 5, 2025
0b21e53
standalone: Fix default port comment for Cloud environments
doringeman Jun 5, 2025
89356bf
docs: update link to avoid redirect
thaJeztah Jun 6, 2025
f7f0131
Construct Compose provider URLs through container inspection
xenoscopic Jun 12, 2025
19d70fb
context: remove always false treatDesktopAsMoby conditions
doringeman Jun 12, 2025
3770ff2
Switch Compose context handling to switch statement
xenoscopic Jun 12, 2025
c0e05c5
Merge pull request #80 from docker/compose-gateway-url
xenoscopic Jun 12, 2025
78363d5
Merge pull request #82 from doringeman/misc
doringeman Jun 13, 2025
f34a804
compose: fix nil pointer panic in standalone runner validation
doringeman Jun 13, 2025
1853a48
Merge pull request #84 from doringeman/misc
doringeman Jun 13, 2025
077750d
Configure inference backend via compose up
doringeman Jun 11, 2025
4f43230
Merge pull request #79 from doringeman/compose-llama-args
doringeman Jun 13, 2025
b6c4852
Inspect remote model (#81)
ilopezluna Jun 13, 2025
b5cb3af
context: Detect DD based on the OS and allow WSL2 client
doringeman Jun 13, 2025
ada3a33
chore: remove use of fmt.Printf
doringeman Jun 13, 2025
38ae609
chore: desktop: fix missing argument in call to Inspect
doringeman Jun 13, 2025
eacef42
Merge pull request #88 from doringeman/tests
xenoscopic Jun 13, 2025
9acb7ca
Merge pull request #87 from doringeman/misc
xenoscopic Jun 13, 2025
9f05dec
Inform standalone installations of their operating environment.
xenoscopic Jun 13, 2025
e84dba4
Don't bind the bridge gateway IP if we're treating Docker Desktop as …
doringeman Jun 12, 2025
3d333f6
Merge pull request #86 from doringeman/desktop-context
doringeman Jun 16, 2025
587200e
Merge pull request #83 from doringeman/skip-bridge-binding-dd
doringeman Jun 16, 2025
7afd493
Allow setting controller image version via env
Jun 13, 2025
21c7801
Merge pull request #91 from docker/model-runner-environment
xenoscopic Jun 16, 2025
1a9ad49
Work around TOCTTOU install check race
xenoscopic Jun 13, 2025
c1e4512
Merge pull request #90 from docker/tocttou
xenoscopic Jun 16, 2025
1ef568d
Enable automatic API version negotiation for the Docker client
doringeman Jun 16, 2025
2ac82c3
Bump Moby-related projects to v28.2.2.
xenoscopic Jun 16, 2025
651163c
Merge pull request #92 from docker/moby-bump
xenoscopic Jun 16, 2025
1dee910
Merge pull request #93 from doringeman/api-version-negotiation
xenoscopic Jun 16, 2025
f3cd2e4
add compose metadata subcommand to return information about model run…
glours Jun 5, 2025
9a84f47
context: Use cli's current context instead of "desktop-linux"
doringeman Jun 18, 2025
d99b580
Fix install race detection using more tolerant polling.
xenoscopic Jun 18, 2025
6b267da
Don't show "Setting context size to -1"
xenoscopic Jun 18, 2025
1e1469f
Update commands/compose.go
xenoscopic Jun 18, 2025
3d8fa44
Merge pull request #96 from docker/ctx-status
xenoscopic Jun 18, 2025
b0036ff
Update pkg/standalone/containers.go
xenoscopic Jun 18, 2025
5d62cb8
Merge pull request #95 from docker/tocttou-redux
xenoscopic Jun 18, 2025
bdbabf2
Small fix for GitHub suggestion curly bracket issue.
xenoscopic Jun 18, 2025
c987f89
Merge pull request #97 from docker/syntax-fix
xenoscopic Jun 18, 2025
d5e885f
use docker API client interfaces instead of concrete type
thaJeztah Jun 19, 2025
e8f21cc
Merge pull request #94 from doringeman/misc
doringeman Jun 20, 2025
bdd5c51
Merge pull request #100 from thaJeztah/use_interfaces
xenoscopic Jun 20, 2025
633a30d
Copy Docker config into controller container (#89)
ilopezluna Jun 20, 2025
e46d480
don't use ANSI sequence on non-tty output
ndeloof Jun 25, 2025
50b2a6c
Merge pull request #103 from ndeloof/tty
xenoscopic Jun 25, 2025
dd65cc4
introduce status --json and document endpoint URL
ndeloof Jun 25, 2025
f50e7e4
Merge pull request #77 from glours/compose-provider-metadata
xenoscopic Jun 25, 2025
2fc0df7
Update docs for new status flag.
xenoscopic Jun 25, 2025
a4a8978
Merge pull request #78 from thaJeztah/update_links
xenoscopic Jun 25, 2025
55ddd3d
status: prevent JSON unmarshal errors on empty status
doringeman Jun 26, 2025
2b568f6
Merge pull request #104 from ndeloof/endpoint_json
doringeman Jun 26, 2025
ef85c86
Skip copy config on DD local and cloud
ilopezluna Jun 26, 2025
c5fea3a
Merge pull request #105 from docker/skip-copy-config-for-dd
xenoscopic Jun 26, 2025
929c032
Use correct containerd error detection.
xenoscopic Jun 18, 2025
44fe56d
simplify container start logic, taking advantage of idempotency
thaJeztah Jun 19, 2025
c33c88d
Clean up a few bits post-rebase and don't return on nil error.
xenoscopic Jun 20, 2025
dded24f
Allow EOF errors to pass silently on ContainerStart.
xenoscopic Jun 20, 2025
462ef1a
Rename waitForContainerToStart to ensureContainerStarted
xenoscopic Jun 26, 2025
c46a752
Add configure command to support Compose models implementation
xenoscopic Jun 26, 2025
19b82c2
configure: validate exactly one model argument before -- separator
doringeman Jun 27, 2025
1345d29
configure: enable completion
doringeman Jun 27, 2025
7f3479b
Merge pull request #107 from docker/container-start-cleanup-rebase
xenoscopic Jun 27, 2025
0a5cbb3
Finalize docker/model-runner module update
xenoscopic Jun 27, 2025
da0b8a6
Merge pull request #106 from docker/configure-command
xenoscopic Jun 27, 2025
8cc1646
Adds --context-size option to package command
ekcasey Jun 27, 2025
47738ca
Update docs for --context-size
ekcasey Jun 27, 2025
d38edc8
Adds context_size to model inspect output
ekcasey Jun 27, 2025
42cd726
Bump model-distribution to reference changes on main branch
ekcasey Jun 27, 2025
97f44c1
Update desktop/api.go
ekcasey Jun 27, 2025
0b21dda
Merge pull request #108 from docker/context-size
ekcasey Jun 27, 2025
7ea2d8d
Merge pull request #109 from docker/inspect-context-size
ekcasey Jun 27, 2025
4915a65
docs: note about quantized models
ArthurFlag Jun 30, 2025
9302f08
make docs
ArthurFlag Jun 30, 2025
f617edd
Use model structs imported from model-runner
doringeman Jun 30, 2025
09ed234
Merge pull request #111 from doringeman/misc
doringeman Jun 30, 2025
edac824
chore: use constant format strings
doringeman Jun 30, 2025
cf6c379
Merge pull request #112 from doringeman/misc
doringeman Jun 30, 2025
0ab9371
update
ArthurFlag Jul 1, 2025
73b89b6
Merge pull request #110 from ArthurFlag/ENGDOCS-2787-update-model-pul…
ArthurFlag Jul 1, 2025
c8c5214
Add temporary string check for docker daemon errors
doringeman Jul 1, 2025
5e46f5a
Merge pull request #115 from doringeman/fixes
xenoscopic Jul 1, 2025
7a08e1a
run: use the provided model reference
doringeman Jul 2, 2025
3b14f66
ps: display SHAs truncated
doringeman Jul 2, 2025
9e70161
Merge pull request #116 from doringeman/fixes
doringeman Jul 3, 2025
228cfc2
fix: align DMR URLs to consistently include trailing slash
fiam Jul 3, 2025
f440b22
docs: hide `configure`
ArthurFlag Jul 3, 2025
d169b4c
Merge pull request #117 from fiam/align_urls
xenoscopic Jul 3, 2025
a187fc4
fmt
ArthurFlag Jul 3, 2025
df71e1f
Merge pull request #118 from ArthurFlag/ENGDOCS-2809-hide-cli-command
ArthurFlag Jul 3, 2025
b7fa673
package: no completion (disable file completion)
doringeman Jul 4, 2025
fac4dfe
tag: enable completion
doringeman Jul 4, 2025
060a644
Merge pull request #121 from doringeman/misc
doringeman Jul 4, 2025
5593d33
Add configurable User-Agent via USER_AGENT env var
doringeman Jul 8, 2025
481e29c
Allow tag with implicit registry
ekcasey Jul 9, 2025
c505c45
Merge pull request #123 from doringeman/tracking
doringeman Jul 9, 2025
3e0576d
Improve progress message (#120)
ilopezluna Jul 11, 2025
f7ed9fb
Support multiline (#125)
ilopezluna Jul 11, 2025
e9b31b7
rm: show untagged model information
doringeman Jul 4, 2025
455cd0b
Merge pull request #122 from doringeman/rm-untagged-msg
doringeman Jul 11, 2025
55e0524
Always use 2 decimals (#127)
ilopezluna Jul 11, 2025
a32a512
Merge pull request #124 from docker/tag-with-implicit-registry
ekcasey Jul 11, 2025
d644e5e
Backend flag support (#126)
ilopezluna Jul 14, 2025
4087321
added a readme
Jul 16, 2025
d7d3e72
Hide --backend flag on list and run for now.
xenoscopic Jul 23, 2025
6b6c9b5
Ensure backend key values are sorted
xenoscopic Jul 23, 2025
48a3d87
Merge pull request #131 from docker/hide-backend-flags
xenoscopic Jul 23, 2025
a622fc9
docker model package without --push
ekcasey Jul 18, 2025
64f4899
cleanup
ekcasey Jul 24, 2025
cdccd09
update docs
ekcasey Jul 24, 2025
fb73e9b
package: require tag
doringeman Jul 24, 2025
7427cb9
Bump model-runner to https://github.com/docker/model-runner/commit/77…
doringeman Jul 24, 2025
7730f38
package: replace TAG with MODEL and use standard usage string
doringeman Jul 24, 2025
fb13633
Bump model-runner to https://github.com/docker/model-runner/commit/ec…
doringeman Jul 24, 2025
8d1ffbd
Merge pull request #132 from docker/package-without-push
doringeman Jul 24, 2025
d1d74fa
context: fix Docker Desktop detection from within WSL2
doringeman Jul 24, 2025
59018a5
Merge pull request #133 from doringeman/context
doringeman Jul 24, 2025
5778df2
Print reasoning content in chat
Aug 12, 2025
c0e7872
Merge branch 'docker:main' into readme
garrettHensley Aug 20, 2025
b77b8be
Adjusted readme from PR feedback
garrettHensley Aug 20, 2025
304b7c9
Allow stdin and multiple prompt args
ericcurtin Aug 18, 2025
3526c6d
Merge pull request #130 from garrettHensley/readme
xenoscopic Aug 21, 2025
9a6b148
Add flags for disabling pre-pull memory estimation
Aug 20, 2025
58d1261
Support packaging sharded models
ekcasey Aug 22, 2025
98e3c6e
Provide guidance for packaging sharded models in help text
ekcasey Aug 22, 2025
32594d1
Merge pull request #142 from docker/shards
ekcasey Aug 22, 2025
c069e28
fix typo in --push usage
ekcasey Aug 20, 2025
aa47e9b
Merge pull request #141 from docker/typo-fix
ekcasey Aug 22, 2025
cdbe1de
ci: add a validate-tests bake target (#145)
fiam Aug 27, 2025
143c7ef
fix(standalone): don't copy config if Desktop is treated as Moby
doringeman Aug 27, 2025
f5b0f6e
Merge pull request #139 from ericcurtin/stdin
xenoscopic Aug 27, 2025
52ffaf0
Merge pull request #146 from docker/skip-docker-config-in-dd-as-moby
doringeman Aug 27, 2025
6557e74
feat(command): remove experimental CLI annotation
doringeman Sep 2, 2025
ccc376c
Merge pull request #148 from doringeman/ga
doringeman Sep 2, 2025
bb13d75
fix(CLI hint): DMR is now under AI
doringeman Sep 10, 2025
5781949
Merge pull request #149 from doringeman/dmr-ga
doringeman Sep 11, 2025
5db656e
feat(list): filter based on model arg
doringeman Sep 11, 2025
85c86b5
chore: bump model-runner
doringeman Sep 12, 2025
6376fa2
feat: add requests monitoring
doringeman Sep 12, 2025
ca956d5
Merge pull request #150 from doringeman/ls-completion
doringeman Sep 15, 2025
82e5f3b
refactor: combine the requests endpoints
doringeman Sep 15, 2025
394ed36
docs: add `docker model requess`
doringeman Sep 15, 2025
44f2250
deps: fix build by manually adding the patched go-winjob to support w…
doringeman Sep 15, 2025
0ba9580
fix(requests): URL encode model filter parameter
doringeman Sep 16, 2025
ff81297
Merge pull request #151 from doringeman/requests-sse
doringeman Sep 17, 2025
757ccb1
feat(run/chat): add Markdown rendering
doringeman Sep 18, 2025
c35a309
Allow models to be packaged with custom chat template files
ekcasey Sep 15, 2025
439344b
Merge pull request #152 from docker/template
ekcasey Sep 18, 2025
f59d083
feat(run/chat): add --color flag for output formatting and coloring
doringeman Sep 19, 2025
b8ee609
fix(run/chat): bring back streaming
doringeman Sep 19, 2025
5657a37
fix(run/chat): restore the original reasoning format
doringeman Sep 19, 2025
f679718
fix(desktop/chat): remove unused parameter
doringeman Sep 19, 2025
d304053
feat(run/chat): display token usage
doringeman Sep 19, 2025
8036f0a
Merge pull request #153 from doringeman/render
ericcurtin Sep 19, 2025
b61770e
Add AI accelerator device mounting support in CreateControllerContainer
ericcurtin Sep 20, 2025
aa3b37e
Merge pull request #154 from ericcurtin/ai-accelerator-device-mountin…
ericcurtin Sep 22, 2025
3e5ab4e
build: set macOS 14 minimum version
doringeman Sep 22, 2025
4f3cbd1
build: run on macos-latest
doringeman Sep 22, 2025
69965c7
Merge pull request #155 from doringeman/macos-14
doringeman Sep 23, 2025
858fe63
Improve CUDA detection
ekcasey Sep 25, 2025
2cae2bb
Only specify nvidia runtime if one exists
ekcasey Sep 25, 2025
f3c52a4
Merge pull request #156 from docker/cuda-detection
ericcurtin Sep 26, 2025
b1f0a10
Merge model-cli into cmd/cli preserving full git history
doringeman Oct 2, 2025
369e604
Merge pull request #76 from doringeman/ports-docs
doringeman Oct 2, 2025
a39f8ce
Merge latest model-cli changes into cmd/cli
doringeman Oct 2, 2025
344ca1b
cli: keep github workflows
doringeman Oct 2, 2025
bbb7e9b
cli: remove vendor
doringeman Oct 2, 2025
13d99c4
cli: various build fixes
doringeman Oct 3, 2025
e23bc1e
chore: remove LICENSE from cmd/cli/
doringeman Oct 3, 2025
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
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Version control
.git/
.gitignore

# IDE and editor files
Expand Down Expand Up @@ -73,4 +72,4 @@ Dockerfile*
.Spotlight-V100
.Trashes

# Exclude nothing else; keep source code and necessary files for build
# Exclude nothing else; keep source code and necessary files for build
44 changes: 44 additions & 0 deletions .github/workflows/cli-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build model-cli

on:
push:
branches: [ "main" ]
paths:
- 'cmd/cli/**'
- '.github/workflows/cli-build.yml'
pull_request:
branches: [ "main" ]
paths:
- 'cmd/cli/**'
- '.github/workflows/cli-build.yml'
workflow_dispatch:
inputs:
branch:
description: "Branch"
required: true
default: "main"

jobs:
build:
runs-on: macos-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: cmd/cli/go.mod
cache: true
cache-dependency-path: cmd/cli/go.sum
- name: Build model-cli
working-directory: cmd/cli
run: |
make release VERSION=${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: dist
path: |
cmd/cli/dist/
retention-days: 2
if-no-files-found: error
66 changes: 66 additions & 0 deletions .github/workflows/cli-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Validate model-cli

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- 'main'
- 'v[0-9]*'
tags:
- 'v*'
paths:
- 'cmd/cli/**'
- '.github/workflows/cli-validate.yml'
pull_request:
paths:
- 'cmd/cli/**'
- '.github/workflows/cli-validate.yml'

jobs:
prepare:
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v6

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Validate model-cli' step
Uses Step: generate
uses 'docker/bake-action/subaction/list-targets' with ref 'v6', not a pinned commit hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
files: ./cmd/cli/docker-bake.hcl
target: validate

validate:
runs-on: ubuntu-24.04
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Validate model-cli' step
Uses Step
uses 'docker/setup-buildx-action' with ref 'v3', not a pinned commit hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
buildkitd-flags: --debug
-
name: Validate
uses: docker/bake-action@v6

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Validate model-cli' step
Uses Step
uses 'docker/bake-action' with ref 'v6', not a pinned commit hash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
files: ./cmd/cli/docker-bake.hcl
workdir: ./cmd/cli
targets: ${{ matrix.target }}
3 changes: 3 additions & 0 deletions cmd/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
model-cli
.idea/
dist/
54 changes: 54 additions & 0 deletions cmd/cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION=1.24
ARG ALPINE_VERSION=3.21

ARG DOCS_FORMATS="md,yaml"

FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
RUN apk add --no-cache rsync git
ENV CGO_ENABLED=0
WORKDIR /src

FROM base AS docs-gen
RUN --mount=target=. \
--mount=target=/root/.cache,type=cache \
go build -C cmd/cli -o /out/docsgen ./docs/generate.go

FROM base AS docs-build
COPY --from=docs-gen /out/docsgen /usr/bin
ENV DOCKER_CLI_PLUGIN_ORIGINAL_CLI_COMMAND="model"
ARG DOCS_FORMATS
RUN --mount=target=/context \
--mount=target=.,type=tmpfs <<EOT
set -e
rsync -a --exclude='models-store' /context/. .
docsgen --formats "$DOCS_FORMATS" --source "cmd/cli/docs/reference"
mkdir /out
cp -r cmd/cli/docs/reference/* /out/
EOT

FROM scratch AS docs-update
COPY --from=docs-build /out /

FROM docs-build AS docs-validate
RUN --mount=target=/context \
--mount=target=.,type=tmpfs <<EOT
set -e
rsync -a --exclude='models-store' /context/. .
git add -A
rm -rf cmd/cli/docs/reference/*
cp -rf /out/* ./cmd/cli/docs/reference/
if [ -n "$(git status --porcelain -- docs/reference)" ]; then
echo >&2 'ERROR: Docs result differs. Please update with "make docs"'
git status --porcelain -- cmd/cli/docs/reference
exit 1
fi
EOT

FROM base AS test
RUN apk add --no-cache make gcc musl-dev
WORKDIR /src
RUN --mount=target=. \
--mount=target=/root/.cache,type=cache \
CGO_ENABLED=1 make unit-tests
79 changes: 79 additions & 0 deletions cmd/cli/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
.PHONY: all build clean link mock unit-tests docs

BINARY_NAME=model-cli

PLUGIN_DIR=$(HOME)/.docker/cli-plugins
PLUGIN_NAME=docker-model

VERSION ?=

MACOS_MIN_VERSION := 14.0
MACOS_MIN_VERSION_LDFLAG := -mmacosx-version-min=$(MACOS_MIN_VERSION)

all: build

build:
@echo "Building $(BINARY_NAME)..."
go build -ldflags="-s -w" -o $(BINARY_NAME) .

link:
@if [ ! -f $(BINARY_NAME) ]; then \
echo "Binary not found, building first..."; \
$(MAKE) build; \
else \
echo "Using existing binary $(BINARY_NAME)"; \
fi
@echo "Linking $(BINARY_NAME) to Docker CLI plugins directory..."
@mkdir -p $(PLUGIN_DIR)
@ln -sf $(shell pwd)/$(BINARY_NAME) $(PLUGIN_DIR)/$(PLUGIN_NAME)
@echo "Link created: $(PLUGIN_DIR)/$(PLUGIN_NAME)"

install: build link

release:
@if [ -z "$(VERSION)" ]; then \
echo "Error: VERSION parameter is required. Use: make release VERSION=x.y.z"; \
exit 1; \
fi
@echo "Building release version '$(VERSION)'..."
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CGO_CFLAGS="$(MACOS_MIN_VERSION_LDFLAG)" CGO_LDFLAGS="$(MACOS_MIN_VERSION_LDFLAG)" go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/darwin-arm64/$(PLUGIN_NAME) .
GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/windows-amd64/$(PLUGIN_NAME).exe .
GOOS=windows GOARCH=arm64 go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/windows-arm64/$(PLUGIN_NAME).exe .
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/linux-amd64/$(PLUGIN_NAME) .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/linux-arm64/$(PLUGIN_NAME) .
@echo "Release build complete: $(PLUGIN_NAME) version '$(VERSION)'"

ce-release:
@if [ -z "$(VERSION)" ]; then \
echo "Error: VERSION parameter is required. Use: make release VERSION=x.y.z"; \
exit 1; \
fi
@if [ "$(uname -s)" != "Linux" ]; then \
echo "Warning: This release target is designed for Linux"; \
fi
@echo "Building local release version '$(VERSION)'..."
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w -X github.com/docker/model-cli/desktop.Version=$(VERSION)" -o dist/$(PLUGIN_NAME) .
@echo "Local release build complete: $(PLUGIN_NAME) version '$(VERSION)'"

mock:
@echo "Generating mocks..."
@mkdir -p mocks
@go generate ./...
@echo "Mocks generated!"

unit-tests:
@echo "Running unit tests..."
@go test -race -v ./...
@echo "Unit tests completed!"

clean:
@echo "Cleaning up..."
@rm -f $(BINARY_NAME)
@echo "Cleaned!"

docs:
$(eval $@_TMP_OUT := $(shell mktemp -d -t model-cli-output.XXXXXXXXXX))
docker buildx bake --allow=fs.read=$(shell cd ../.. && pwd) --set "*.output=type=local,dest=$($@_TMP_OUT)" update-docs
rm -rf ./docs/reference/*
cp -R "$($@_TMP_OUT)"/* ./docs/reference/
rm -rf "$($@_TMP_OUT)"/*
77 changes: 77 additions & 0 deletions cmd/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Docker Model CLI

A powerful command-line interface for managing, running, packaging, and deploying AI/ML models using Docker. This CLI lets you install and control the Docker Model Runner, interact with models, manage model artifacts, and integrate with OpenAI and other backends—all from your terminal.

## Features
- **Install Model Runner**: Easily set up the Docker Model Runner for local or cloud environments with GPU support.
- **Run Models**: Execute models with prompts or in interactive chat mode, supporting multiline input and OpenAI-style backends.
- **List Models**: View all models available locally or via OpenAI, with options for JSON and quiet output.
- **Package Models**: Convert GGUF files into Docker model OCI artifacts and push them to registries, including license and context size options.
- **Configure Models**: Set runtime flags and context sizes for models.
- **Logs & Status**: Stream logs and check the status of the Model Runner and individual models.
- **Tag, Pull, Push, Remove, Unload**: Full lifecycle management for model artifacts.
- **Compose & Desktop Integration**: Advanced orchestration and desktop support for model backends.

## Building
1. **Clone the repo:**
```bash
git clone https://github.com/docker/model-cli.git
cd model-cli
```
2. **Build the CLI:**
```bash
make build
```
3. **Install Model Runner:**
```bash
./model install-runner
```
Use `--gpu cuda` for GPU support, or `--gpu auto` for automatic detection.

## Usage
Run `./model --help` to see all commands and options.

### Common Commands
- `model install-runner` — Install the Docker Model Runner
- `model run MODEL [PROMPT]` — Run a model with a prompt or enter chat mode
- `model list` — List available models
- `model package --gguf <path> --push <target>` — Package and push a model
- `model logs` — View logs
- `model status` — Check runner status
- `model configure MODEL [flags]` — Configure model runtime
- `model unload MODEL` — Unload a model
- `model tag SOURCE TARGET` — Tag a model
- `model pull MODEL` — Pull a model
- `model push MODEL` — Push a model
- `model rm MODEL` — Remove a model

## Example: Interactive Chat
```bash
./model run llama.cpp "What is the capital of France?"
```
Or enter chat mode:
```bash
./model run llama.cpp
Interactive chat mode started. Type '/bye' to exit.
> """
Tell me a joke.
"""
```

## Advanced
- **Packaging:**
Add licenses and set context size when packaging models for distribution.

## Development
- **Run unit tests:**
```bash
make unit-tests
```
- **Generate docs:**
```bash
make docs
```

## License
[Apache 2.0](LICENSE)

43 changes: 43 additions & 0 deletions cmd/cli/commands/backend.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package commands

import (
"errors"
"fmt"
"maps"
"os"
"slices"
"strings"
)

// ValidBackends is a map of valid backends
var ValidBackends = map[string]bool{
"llama.cpp": true,
"openai": true,
}

// validateBackend checks if the provided backend is valid
func validateBackend(backend string) error {
if !ValidBackends[backend] {
return fmt.Errorf("invalid backend '%s'. Valid backends are: %s",
backend, ValidBackendsKeys())
}
return nil
}

// ensureAPIKey retrieves the API key if needed
func ensureAPIKey(backend string) (string, error) {
if backend == "openai" {
apiKey := os.Getenv("OPENAI_API_KEY")
if apiKey == "" {
return "", errors.New("OPENAI_API_KEY environment variable is required when using --backend=openai")
}
return apiKey, nil
}
return "", nil
}

func ValidBackendsKeys() string {
keys := slices.Collect(maps.Keys(ValidBackends))
slices.Sort(keys)
return strings.Join(keys, ", ")
}
Loading
Loading