return empty if docker is offline
This commit is contained in:
parent
61f7fd89db
commit
f12bf1a327
1 changed files with 4 additions and 2 deletions
6
main.go
6
main.go
|
@ -121,13 +121,15 @@ func get_ollama_containers(host Host, all bool) Containers {
|
||||||
fmt.Printf("%s -> %s\n", host.Name, host.IP)
|
fmt.Printf("%s -> %s\n", host.Name, host.IP)
|
||||||
cli, err := client.NewClientWithOpts(client.WithHost(fmt.Sprintf("tcp://%s:%s", host.IP, host.Port)))
|
cli, err := client.NewClientWithOpts(client.WithHost(fmt.Sprintf("tcp://%s:%s", host.IP, host.Port)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
fmt.Println(err)
|
||||||
|
return ctr_list
|
||||||
}
|
}
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
|
|
||||||
containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: all})
|
containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: all})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
fmt.Println(err)
|
||||||
|
return ctr_list
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ctr := range containers {
|
for _, ctr := range containers {
|
||||||
|
|
Loading…
Add table
Reference in a new issue