diff --git a/.gitignore b/.gitignore index 4798d6837..5b01aba1a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ model-distribution-tool model-runner model-runner.sock +docker-model # Default MODELS_PATH in Makefile models-store/ # Default MODELS_PATH in mdltool diff --git a/cmd/cli/README.md b/cmd/cli/README.md index a3f8d628a..fc361d087 100644 --- a/cmd/cli/README.md +++ b/cmd/cli/README.md @@ -33,6 +33,9 @@ Run `./model --help` to see all commands and options. ### Common Commands - `model install-runner` — Install the Docker Model Runner +- `model start-runner` — Start the Docker Model Runner +- `model stop-runner` — Stop the Docker Model Runner +- `model restart-runner` — Restart 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 --push ` — Package and push a model diff --git a/cmd/cli/commands/install-runner.go b/cmd/cli/commands/install-runner.go index 62fca1079..a70e824bf 100644 --- a/cmd/cli/commands/install-runner.go +++ b/cmd/cli/commands/install-runner.go @@ -160,6 +160,108 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta return inspectStandaloneRunner(container), nil } +// runnerOptions holds common configuration for install/start commands +type runnerOptions struct { + port uint16 + host string + gpuMode string + doNotTrack bool + pullImage bool +} + +// runInstallOrStart is shared logic for install-runner and start-runner commands +func runInstallOrStart(cmd *cobra.Command, opts runnerOptions) error { + // Ensure that we're running in a supported model runner context. + engineKind := modelRunner.EngineKind() + if engineKind == types.ModelRunnerEngineKindDesktop { + // TODO: We may eventually want to auto-forward this to + // docker desktop enable model-runner, but we should first make + // sure the CLI flags match. + cmd.Println("Standalone installation not supported with Docker Desktop") + cmd.Println("Use `docker desktop enable model-runner` instead") + return nil + } else if engineKind == types.ModelRunnerEngineKindMobyManual { + cmd.Println("Standalone installation not supported with MODEL_RUNNER_HOST set") + return nil + } + + port := opts.port + if port == 0 { + // Use "0" as a sentinel default flag value so it's not displayed automatically. + // The default values are written in the usage string. + // Hence, the user currently won't be able to set the port to 0 in order to get a random available port. + port = standalone.DefaultControllerPortMoby + } + // HACK: If we're in a Cloud context, then we need to use a + // different default port because it conflicts with Docker Desktop's + // default model runner host-side port. Unfortunately we can't make + // the port flag default dynamic (at least not easily) because of + // when context detection happens. So assume that a default value + // indicates that we want the Cloud default port. This is less + // problematic in Cloud since the UX there is mostly invisible. + if engineKind == types.ModelRunnerEngineKindCloud && + port == standalone.DefaultControllerPortMoby { + port = standalone.DefaultControllerPortCloud + } + + // Set the appropriate environment. + environment := "moby" + if engineKind == types.ModelRunnerEngineKindCloud { + environment = "cloud" + } + + // Create a Docker client for the active context. + dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext()) + if err != nil { + return fmt.Errorf("failed to create Docker client: %w", err) + } + + // Check if an active model runner container already exists. + if ctrID, ctrName, _, err := standalone.FindControllerContainer(cmd.Context(), dockerClient); err != nil { + return err + } else if ctrID != "" { + if ctrName != "" { + cmd.Printf("Model Runner container %s (%s) is already running\n", ctrName, ctrID[:12]) + } else { + cmd.Printf("Model Runner container %s is already running\n", ctrID[:12]) + } + return nil + } + + // Determine GPU support. + var gpu gpupkg.GPUSupport + if opts.gpuMode == "auto" { + gpu, err = gpupkg.ProbeGPUSupport(cmd.Context(), dockerClient) + if err != nil { + return fmt.Errorf("unable to probe GPU support: %w", err) + } + } else if opts.gpuMode == "cuda" { + gpu = gpupkg.GPUSupportCUDA + } else if opts.gpuMode != "none" { + return fmt.Errorf("unknown GPU specification: %q", opts.gpuMode) + } + + // Ensure that we have an up-to-date copy of the image, if requested. + if opts.pullImage { + if err := standalone.EnsureControllerImage(cmd.Context(), dockerClient, gpu, cmd); err != nil { + return fmt.Errorf("unable to pull latest standalone model runner image: %w", err) + } + } + + // Ensure that we have a model storage volume. + modelStorageVolume, err := standalone.EnsureModelStorageVolume(cmd.Context(), dockerClient, cmd) + if err != nil { + return fmt.Errorf("unable to initialize standalone model storage: %w", err) + } + // Create the model runner container. + if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, modelStorageVolume, cmd, engineKind); err != nil { + return fmt.Errorf("unable to initialize standalone model runner container: %w", err) + } + + // Poll until we get a response from the model runner. + return waitForStandaloneRunnerAfterInstall(cmd.Context()) +} + func newInstallRunner() *cobra.Command { var port uint16 var host string @@ -169,97 +271,18 @@ func newInstallRunner() *cobra.Command { Use: "install-runner", Short: "Install Docker Model Runner (Docker Engine only)", RunE: func(cmd *cobra.Command, args []string) error { - // Ensure that we're running in a supported model runner context. - engineKind := modelRunner.EngineKind() - if engineKind == types.ModelRunnerEngineKindDesktop { - // TODO: We may eventually want to auto-forward this to - // docker desktop enable model-runner, but we should first make - // sure the CLI flags match. - cmd.Println("Standalone installation not supported with Docker Desktop") - cmd.Println("Use `docker desktop enable model-runner` instead") - return nil - } else if engineKind == types.ModelRunnerEngineKindMobyManual { - cmd.Println("Standalone installation not supported with MODEL_RUNNER_HOST set") - return nil - } - - if port == 0 { - // Use "0" as a sentinel default flag value so it's not displayed automatically. - // The default values are written in the usage string. - // Hence, the user currently won't be able to set the port to 0 in order to get a random available port. - port = standalone.DefaultControllerPortMoby - } - // HACK: If we're in a Cloud context, then we need to use a - // different default port because it conflicts with Docker Desktop's - // default model runner host-side port. Unfortunately we can't make - // the port flag default dynamic (at least not easily) because of - // when context detection happens. So assume that a default value - // indicates that we want the Cloud default port. This is less - // problematic in Cloud since the UX there is mostly invisible. - if engineKind == types.ModelRunnerEngineKindCloud && - port == standalone.DefaultControllerPortMoby { - port = standalone.DefaultControllerPortCloud - } - - // Set the appropriate environment. - environment := "moby" - if engineKind == types.ModelRunnerEngineKindCloud { - environment = "cloud" - } - - // Create a Docker client for the active context. - dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext()) - if err != nil { - return fmt.Errorf("failed to create Docker client: %w", err) - } - - // Check if an active model runner container already exists. - if ctrID, ctrName, _, err := standalone.FindControllerContainer(cmd.Context(), dockerClient); err != nil { - return err - } else if ctrID != "" { - if ctrName != "" { - cmd.Printf("Model Runner container %s (%s) is already running\n", ctrName, ctrID[:12]) - } else { - cmd.Printf("Model Runner container %s is already running\n", ctrID[:12]) - } - return nil - } - - // Determine GPU support. - var gpu gpupkg.GPUSupport - if gpuMode == "auto" { - gpu, err = gpupkg.ProbeGPUSupport(cmd.Context(), dockerClient) - if err != nil { - return fmt.Errorf("unable to probe GPU support: %w", err) - } - } else if gpuMode == "cuda" { - gpu = gpupkg.GPUSupportCUDA - } else if gpuMode != "none" { - return fmt.Errorf("unknown GPU specification: %q", gpuMode) - } - - // Ensure that we have an up-to-date copy of the image. - if err := standalone.EnsureControllerImage(cmd.Context(), dockerClient, gpu, cmd); err != nil { - return fmt.Errorf("unable to pull latest standalone model runner image: %w", err) - } - - // Ensure that we have a model storage volume. - modelStorageVolume, err := standalone.EnsureModelStorageVolume(cmd.Context(), dockerClient, cmd) - if err != nil { - return fmt.Errorf("unable to initialize standalone model storage: %w", err) - } - // Create the model runner container. - if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, host, environment, doNotTrack, gpu, modelStorageVolume, cmd, engineKind); err != nil { - return fmt.Errorf("unable to initialize standalone model runner container: %w", err) - } - - // Poll until we get a response from the model runner. - return waitForStandaloneRunnerAfterInstall(cmd.Context()) + return runInstallOrStart(cmd, runnerOptions{ + port: port, + host: host, + gpuMode: gpuMode, + doNotTrack: doNotTrack, + pullImage: true, + }) }, ValidArgsFunction: completion.NoComplete, } c.Flags().Uint16Var(&port, "port", 0, - "Docker container port for Docker Model Runner (default: 12434 for Docker CE, 12435 for Cloud mode)") + "Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode)") c.Flags().StringVar(&host, "host", "127.0.0.1", "Host address to bind Docker Model Runner") c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)") c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner") diff --git a/cmd/cli/commands/restart-runner.go b/cmd/cli/commands/restart-runner.go new file mode 100644 index 000000000..77ffa1bc0 --- /dev/null +++ b/cmd/cli/commands/restart-runner.go @@ -0,0 +1,42 @@ +package commands + +import ( + "github.com/docker/model-runner/cmd/cli/commands/completion" + "github.com/spf13/cobra" +) + +func newRestartRunner() *cobra.Command { + var port uint16 + var host string + var gpuMode string + var doNotTrack bool + c := &cobra.Command{ + Use: "restart-runner", + Short: "Restart Docker Model Runner (Docker Engine only)", + RunE: func(cmd *cobra.Command, args []string) error { + // First stop the runner without removing models or images + if err := runUninstallOrStop(cmd, cleanupOptions{ + models: false, + removeImages: false, + }); err != nil { + return err + } + + // Then start the runner with the provided options + return runInstallOrStart(cmd, runnerOptions{ + port: port, + host: host, + gpuMode: gpuMode, + doNotTrack: doNotTrack, + pullImage: false, + }) + }, + ValidArgsFunction: completion.NoComplete, + } + c.Flags().Uint16Var(&port, "port", 0, + "Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode)") + c.Flags().StringVar(&host, "host", "127.0.0.1", "Host address to bind Docker Model Runner") + c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)") + c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner") + return c +} diff --git a/cmd/cli/commands/root.go b/cmd/cli/commands/root.go index cd9833df9..26400bc6e 100644 --- a/cmd/cli/commands/root.go +++ b/cmd/cli/commands/root.go @@ -106,6 +106,9 @@ func NewRootCmd(cli *command.DockerCli) *cobra.Command { newTagCmd(), newInstallRunner(), newUninstallRunner(), + newStartRunner(), + newStopRunner(), + newRestartRunner(), newConfigureCmd(), newPSCmd(), newDFCmd(), diff --git a/cmd/cli/commands/start-runner.go b/cmd/cli/commands/start-runner.go new file mode 100644 index 000000000..dc195faca --- /dev/null +++ b/cmd/cli/commands/start-runner.go @@ -0,0 +1,30 @@ +package commands + +import ( + "github.com/docker/model-runner/cmd/cli/commands/completion" + "github.com/spf13/cobra" +) + +func newStartRunner() *cobra.Command { + var port uint16 + var gpuMode string + var doNotTrack bool + c := &cobra.Command{ + Use: "start-runner", + Short: "Start Docker Model Runner (Docker Engine only)", + RunE: func(cmd *cobra.Command, args []string) error { + return runInstallOrStart(cmd, runnerOptions{ + port: port, + gpuMode: gpuMode, + doNotTrack: doNotTrack, + pullImage: false, + }) + }, + ValidArgsFunction: completion.NoComplete, + } + c.Flags().Uint16Var(&port, "port", 0, + "Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode)") + c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)") + c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner") + return c +} diff --git a/cmd/cli/commands/stop-runner.go b/cmd/cli/commands/stop-runner.go new file mode 100644 index 000000000..b59af9f69 --- /dev/null +++ b/cmd/cli/commands/stop-runner.go @@ -0,0 +1,23 @@ +package commands + +import ( + "github.com/docker/model-runner/cmd/cli/commands/completion" + "github.com/spf13/cobra" +) + +func newStopRunner() *cobra.Command { + var models bool + c := &cobra.Command{ + Use: "stop-runner", + Short: "Stop Docker Model Runner (Docker Engine only)", + RunE: func(cmd *cobra.Command, args []string) error { + return runUninstallOrStop(cmd, cleanupOptions{ + models: models, + removeImages: false, + }) + }, + ValidArgsFunction: completion.NoComplete, + } + c.Flags().BoolVar(&models, "models", false, "Remove model storage volume") + return c +} diff --git a/cmd/cli/commands/uninstall-runner.go b/cmd/cli/commands/uninstall-runner.go index 092e5d69f..8ab5fbd19 100644 --- a/cmd/cli/commands/uninstall-runner.go +++ b/cmd/cli/commands/uninstall-runner.go @@ -10,51 +10,65 @@ import ( "github.com/spf13/cobra" ) -func newUninstallRunner() *cobra.Command { - var models, images bool - c := &cobra.Command{ - Use: "uninstall-runner", - Short: "Uninstall Docker Model Runner", - RunE: func(cmd *cobra.Command, args []string) error { - // Ensure that we're running in a supported model runner context. - if kind := modelRunner.EngineKind(); kind == types.ModelRunnerEngineKindDesktop { - // TODO: We may eventually want to auto-forward this to - // docker desktop disable model-runner, but we should first - // make install-runner forward in the same way. - cmd.Println("Standalone uninstallation not supported with Docker Desktop") - cmd.Println("Use `docker desktop disable model-runner` instead") - return nil - } else if kind == types.ModelRunnerEngineKindMobyManual { - cmd.Println("Standalone uninstallation not supported with MODEL_RUNNER_HOST set") - return nil - } +// cleanupOptions holds common configuration for uninstall/stop commands +type cleanupOptions struct { + models bool + removeImages bool +} - // Create a Docker client for the active context. - dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext()) - if err != nil { - return fmt.Errorf("failed to create Docker client: %w", err) - } +// runUninstallOrStop is shared logic for uninstall-runner and stop-runner commands +func runUninstallOrStop(cmd *cobra.Command, opts cleanupOptions) error { + // Ensure that we're running in a supported model runner context. + if kind := modelRunner.EngineKind(); kind == types.ModelRunnerEngineKindDesktop { + // TODO: We may eventually want to auto-forward this to + // docker desktop disable model-runner, but we should first + // make install-runner forward in the same way. + cmd.Println("Standalone uninstallation not supported with Docker Desktop") + cmd.Println("Use `docker desktop disable model-runner` instead") + return nil + } else if kind == types.ModelRunnerEngineKindMobyManual { + cmd.Println("Standalone uninstallation not supported with MODEL_RUNNER_HOST set") + return nil + } - // Remove any model runner containers. - if err := standalone.PruneControllerContainers(cmd.Context(), dockerClient, false, cmd); err != nil { - return fmt.Errorf("unable to remove model runner container(s): %w", err) - } + // Create a Docker client for the active context. + dockerClient, err := desktop.DockerClientForContext(dockerCLI, dockerCLI.CurrentContext()) + if err != nil { + return fmt.Errorf("failed to create Docker client: %w", err) + } - // Remove model runner images, if requested. - if images { - if err := standalone.PruneControllerImages(cmd.Context(), dockerClient, cmd); err != nil { - return fmt.Errorf("unable to remove model runner image(s): %w", err) - } - } + // Remove any model runner containers. + if err := standalone.PruneControllerContainers(cmd.Context(), dockerClient, false, cmd); err != nil { + return fmt.Errorf("unable to remove model runner container(s): %w", err) + } - // Remove model storage, if requested. - if models { - if err := standalone.PruneModelStorageVolumes(cmd.Context(), dockerClient, cmd); err != nil { - return fmt.Errorf("unable to remove model storage volume(s): %w", err) - } - } + // Remove model runner images, if requested. + if opts.removeImages { + if err := standalone.PruneControllerImages(cmd.Context(), dockerClient, cmd); err != nil { + return fmt.Errorf("unable to remove model runner image(s): %w", err) + } + } - return nil + // Remove model storage, if requested. + if opts.models { + if err := standalone.PruneModelStorageVolumes(cmd.Context(), dockerClient, cmd); err != nil { + return fmt.Errorf("unable to remove model storage volume(s): %w", err) + } + } + + return nil +} + +func newUninstallRunner() *cobra.Command { + var models, images bool + c := &cobra.Command{ + Use: "uninstall-runner", + Short: "Uninstall Docker Model Runner (Docker Engine only)", + RunE: func(cmd *cobra.Command, args []string) error { + return runUninstallOrStop(cmd, cleanupOptions{ + models: models, + removeImages: images, + }) }, ValidArgsFunction: completion.NoComplete, } diff --git a/cmd/cli/docs/reference/docker_model.yaml b/cmd/cli/docs/reference/docker_model.yaml index a43b12a83..c62069091 100644 --- a/cmd/cli/docs/reference/docker_model.yaml +++ b/cmd/cli/docs/reference/docker_model.yaml @@ -17,9 +17,12 @@ cname: - docker model pull - docker model push - docker model requests + - docker model restart-runner - docker model rm - docker model run + - docker model start-runner - docker model status + - docker model stop-runner - docker model tag - docker model uninstall-runner - docker model unload @@ -36,9 +39,12 @@ clink: - docker_model_pull.yaml - docker_model_push.yaml - docker_model_requests.yaml + - docker_model_restart-runner.yaml - docker_model_rm.yaml - docker_model_run.yaml + - docker_model_start-runner.yaml - docker_model_status.yaml + - docker_model_stop-runner.yaml - docker_model_tag.yaml - docker_model_uninstall-runner.yaml - docker_model_unload.yaml diff --git a/cmd/cli/docs/reference/docker_model_install-runner.yaml b/cmd/cli/docs/reference/docker_model_install-runner.yaml index 67cec4dc5..7d8457170 100644 --- a/cmd/cli/docs/reference/docker_model_install-runner.yaml +++ b/cmd/cli/docs/reference/docker_model_install-runner.yaml @@ -40,7 +40,7 @@ options: value_type: uint16 default_value: "0" description: | - Docker container port for Docker Model Runner (default: 12434 for Docker CE, 12435 for Cloud mode) + Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) deprecated: false hidden: false experimental: false diff --git a/cmd/cli/docs/reference/docker_model_restart-runner.yaml b/cmd/cli/docs/reference/docker_model_restart-runner.yaml new file mode 100644 index 000000000..47819efa9 --- /dev/null +++ b/cmd/cli/docs/reference/docker_model_restart-runner.yaml @@ -0,0 +1,58 @@ +command: docker model restart-runner +short: Restart Docker Model Runner (Docker Engine only) +long: |- + This command restarts the Docker Model Runner without pulling container images. Use this command to restart the runner when you already have the required images locally. + + For the first-time setup or to ensure you have the latest images, use `docker model install-runner` instead. +usage: docker model restart-runner +pname: docker model +plink: docker_model.yaml +options: + - option: do-not-track + value_type: bool + default_value: "false" + description: Do not track models usage in Docker Model Runner + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: gpu + value_type: string + default_value: auto + description: Specify GPU support (none|auto|cuda) + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: host + value_type: string + default_value: 127.0.0.1 + description: Host address to bind Docker Model Runner + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: port + value_type: uint16 + default_value: "0" + description: | + Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false + diff --git a/cmd/cli/docs/reference/docker_model_start-runner.yaml b/cmd/cli/docs/reference/docker_model_start-runner.yaml new file mode 100644 index 000000000..6fda90ad6 --- /dev/null +++ b/cmd/cli/docs/reference/docker_model_start-runner.yaml @@ -0,0 +1,48 @@ +command: docker model start-runner +short: Start Docker Model Runner (Docker Engine only) +long: |- + This command starts the Docker Model Runner without pulling container images. Use this command to start the runner when you already have the required images locally. + + For the first-time setup or to ensure you have the latest images, use `docker model install-runner` instead. +usage: docker model start-runner +pname: docker model +plink: docker_model.yaml +options: + - option: do-not-track + value_type: bool + default_value: "false" + description: Do not track models usage in Docker Model Runner + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: gpu + value_type: string + default_value: auto + description: Specify GPU support (none|auto|cuda) + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: port + value_type: uint16 + default_value: "0" + description: | + Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false + diff --git a/cmd/cli/docs/reference/docker_model_stop-runner.yaml b/cmd/cli/docs/reference/docker_model_stop-runner.yaml new file mode 100644 index 000000000..8d565b868 --- /dev/null +++ b/cmd/cli/docs/reference/docker_model_stop-runner.yaml @@ -0,0 +1,27 @@ +command: docker model stop-runner +short: Stop Docker Model Runner (Docker Engine only) +long: |- + This command stops the Docker Model Runner by removing the running containers, but preserves the container images on disk. Use this command when you want to temporarily stop the runner but plan to start it again later. + + To completely remove the runner including images, use `docker model uninstall-runner --images` instead. +usage: docker model stop-runner +pname: docker model +plink: docker_model.yaml +options: + - option: models + value_type: bool + default_value: "false" + description: Remove model storage volume + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false + diff --git a/cmd/cli/docs/reference/docker_model_uninstall-runner.yaml b/cmd/cli/docs/reference/docker_model_uninstall-runner.yaml index fc2c9f640..b8ec4c77b 100644 --- a/cmd/cli/docs/reference/docker_model_uninstall-runner.yaml +++ b/cmd/cli/docs/reference/docker_model_uninstall-runner.yaml @@ -1,6 +1,6 @@ command: docker model uninstall-runner -short: Uninstall Docker Model Runner -long: Uninstall Docker Model Runner +short: Uninstall Docker Model Runner (Docker Engine only) +long: Uninstall Docker Model Runner (Docker Engine only) usage: docker model uninstall-runner pname: docker model plink: docker_model.yaml diff --git a/cmd/cli/docs/reference/model.md b/cmd/cli/docs/reference/model.md index 9aac7bed4..c74a6fa84 100644 --- a/cmd/cli/docs/reference/model.md +++ b/cmd/cli/docs/reference/model.md @@ -18,11 +18,14 @@ Docker Model Runner | [`pull`](model_pull.md) | Pull a model from Docker Hub or HuggingFace to your local environment | | [`push`](model_push.md) | Push a model to Docker Hub | | [`requests`](model_requests.md) | Fetch requests+responses from Docker Model Runner | +| [`restart-runner`](model_restart-runner.md) | Restart Docker Model Runner (Docker Engine only) | | [`rm`](model_rm.md) | Remove local models downloaded from Docker Hub | | [`run`](model_run.md) | Run a model and interact with it using a submitted prompt or chat mode | +| [`start-runner`](model_start-runner.md) | Start Docker Model Runner (Docker Engine only) | | [`status`](model_status.md) | Check if the Docker Model Runner is running | +| [`stop-runner`](model_stop-runner.md) | Stop Docker Model Runner (Docker Engine only) | | [`tag`](model_tag.md) | Tag a model | -| [`uninstall-runner`](model_uninstall-runner.md) | Uninstall Docker Model Runner | +| [`uninstall-runner`](model_uninstall-runner.md) | Uninstall Docker Model Runner (Docker Engine only) | | [`unload`](model_unload.md) | Unload running models | | [`version`](model_version.md) | Show the Docker Model Runner version | diff --git a/cmd/cli/docs/reference/model_install-runner.md b/cmd/cli/docs/reference/model_install-runner.md index e8911ccaa..e26026b12 100644 --- a/cmd/cli/docs/reference/model_install-runner.md +++ b/cmd/cli/docs/reference/model_install-runner.md @@ -5,12 +5,12 @@ Install Docker Model Runner (Docker Engine only) ### Options -| Name | Type | Default | Description | -|:-----------------|:---------|:------------|:---------------------------------------------------------------------------------------------------| -| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner | -| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) | -| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner | -| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker CE, 12435 for Cloud mode) | +| Name | Type | Default | Description | +|:-----------------|:---------|:------------|:-------------------------------------------------------------------------------------------------------| +| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner | +| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) | +| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner | +| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) | diff --git a/cmd/cli/docs/reference/model_restart-runner.md b/cmd/cli/docs/reference/model_restart-runner.md new file mode 100644 index 000000000..6c38726cc --- /dev/null +++ b/cmd/cli/docs/reference/model_restart-runner.md @@ -0,0 +1,22 @@ +# docker model restart-runner + + +Restart Docker Model Runner (Docker Engine only) + +### Options + +| Name | Type | Default | Description | +|:-----------------|:---------|:------------|:-------------------------------------------------------------------------------------------------------| +| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner | +| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) | +| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner | +| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) | + + + + +## Description + +This command restarts the Docker Model Runner without pulling container images. Use this command to restart the runner when you already have the required images locally. + +For the first-time setup or to ensure you have the latest images, use `docker model install-runner` instead. diff --git a/cmd/cli/docs/reference/model_start-runner.md b/cmd/cli/docs/reference/model_start-runner.md new file mode 100644 index 000000000..c2c018235 --- /dev/null +++ b/cmd/cli/docs/reference/model_start-runner.md @@ -0,0 +1,21 @@ +# docker model start-runner + + +Start Docker Model Runner (Docker Engine only) + +### Options + +| Name | Type | Default | Description | +|:-----------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------| +| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner | +| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda) | +| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) | + + + + +## Description + +This command starts the Docker Model Runner without pulling container images. Use this command to start the runner when you already have the required images locally. + +For the first-time setup or to ensure you have the latest images, use `docker model install-runner` instead. diff --git a/cmd/cli/docs/reference/model_stop-runner.md b/cmd/cli/docs/reference/model_stop-runner.md new file mode 100644 index 000000000..99a6b0cda --- /dev/null +++ b/cmd/cli/docs/reference/model_stop-runner.md @@ -0,0 +1,19 @@ +# docker model stop-runner + + +Stop Docker Model Runner (Docker Engine only) + +### Options + +| Name | Type | Default | Description | +|:-----------|:-------|:--------|:----------------------------| +| `--models` | `bool` | | Remove model storage volume | + + + + +## Description + +This command stops the Docker Model Runner by removing the running containers, but preserves the container images on disk. Use this command when you want to temporarily stop the runner but plan to start it again later. + +To completely remove the runner including images, use `docker model uninstall-runner --images` instead. diff --git a/cmd/cli/docs/reference/model_uninstall-runner.md b/cmd/cli/docs/reference/model_uninstall-runner.md index 3c4a79ceb..ddd455573 100644 --- a/cmd/cli/docs/reference/model_uninstall-runner.md +++ b/cmd/cli/docs/reference/model_uninstall-runner.md @@ -1,7 +1,7 @@ # docker model uninstall-runner -Uninstall Docker Model Runner +Uninstall Docker Model Runner (Docker Engine only) ### Options diff --git a/pkg/distribution/internal/store/store.go b/pkg/distribution/internal/store/store.go index b69d9ecc9..bae3b6a37 100644 --- a/pkg/distribution/internal/store/store.go +++ b/pkg/distribution/internal/store/store.go @@ -47,7 +47,7 @@ func New(opts Options) (*LocalStore, error) { // Reset clears all contents of the store directory and reinitializes the store. // It removes all files and subdirectories within the store's root path, but preserves the root directory itself. -// This allows the method to work correctly when the store directory is a mounted volume (e.g., in Docker CE). +// This allows the method to work correctly when the store directory is a mounted volume (e.g., in Docker Engine). func (s *LocalStore) Reset() error { entries, err := os.ReadDir(s.rootPath) if err != nil {