Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.
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
16 changes: 11 additions & 5 deletions commands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package commands

import (
"fmt"

"github.com/docker/pinata/common/cmd/docker-model/desktop"
"github.com/docker/model-cli/desktop"
"github.com/spf13/cobra"
"os"
)

func newStatusCmd() *cobra.Command {
Expand All @@ -16,11 +16,17 @@ func newStatusCmd() *cobra.Command {
if err != nil {
return fmt.Errorf("Failed to create Docker client: %v\n", err)
}
status, err := client.Status()
if err != nil {
status := client.Status()
if status.Error != nil {
return fmt.Errorf("Failed to get Docker Model Runner status: %v\n", err)
}
cmd.Println(status)
if status.Running {
cmd.Println("Docker Model Runner is running")
} else {
cmd.Println("Docker Model Runner is not running")
os.Exit(1)
}

return nil
},
}
Expand Down
20 changes: 16 additions & 4 deletions desktop/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,29 @@ func New() (*Client, error) {
return &Client{dockerClient}, nil
}

func (c *Client) Status() (string, error) {
type Status struct {
Running bool `json:"running"`
Error error `json:"error"`
}

func (c *Client) Status() Status {
// TODO: Query "/".
resp, err := c.dockerClient.HTTPClient().Get(url(inference.ModelsPrefix))
if err != nil {
return "", err
return Status{
Running: false,
Error: err,
}
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
return "Docker Model Runner is running", nil
return Status{
Running: true,
}
}
return Status{
Running: false,
}
return "Docker Model Runner is not running", nil
}

func (c *Client) Pull(model string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.23.7
require (
github.com/docker/cli v28.0.1+incompatible
github.com/docker/docker v28.0.1+incompatible
github.com/docker/go-units v0.5.0
github.com/docker/pinata v0.0.1-0.20250317110157-7302b389632a
github.com/olekukonko/tablewriter v0.0.5
github.com/pkg/errors v0.9.1
Expand All @@ -26,7 +27,6 @@ require (
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/docker/model-distribution v0.0.0-20250306122437-2530363c51c5 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ github.com/docker/model-distribution/pkg/store
github.com/docker/model-distribution/pkg/types
# github.com/docker/pinata v0.0.1-0.20250317110157-7302b389632a
## explicit; go 1.23.7
github.com/docker/pinata/common/cmd/docker-model/desktop
github.com/docker/pinata/common/pkg/engine
github.com/docker/pinata/common/pkg/inference
github.com/docker/pinata/common/pkg/inference/models
Expand Down