return empty if docker is offline

This commit is contained in:
Miki 2024-06-05 13:24:34 +02:00
parent 61f7fd89db
commit f12bf1a327

View file

@ -121,13 +121,15 @@ func get_ollama_containers(host Host, all bool) Containers {
fmt.Printf("%s -> %s\n", host.Name, host.IP)
cli, err := client.NewClientWithOpts(client.WithHost(fmt.Sprintf("tcp://%s:%s", host.IP, host.Port)))
if err != nil {
panic(err)
fmt.Println(err)
return ctr_list
}
defer cli.Close()
containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: all})
if err != nil {
panic(err)
fmt.Println(err)
return ctr_list
}
for _, ctr := range containers {