You don't need to fetch and loop through all services in the Swarm @
|
for _, service := range services { |
Instead you can add a filter, and fetch the required service directly. E.g.:
serviceFilter := filters.NewArgs()
serviceFilter.Add("id", serviceId)
services, err := dockerClient.ServiceList(ctx, types.ServiceListOptions{Filters: serviceFilter})
Also see: https://docs.docker.com/engine/reference/commandline/service_ls/#filtering
You don't need to fetch and loop through all services in the Swarm @
orbiter/autoscaler/autoscaler.go
Line 56 in e875318
Instead you can add a filter, and fetch the required service directly. E.g.:
Also see: https://docs.docker.com/engine/reference/commandline/service_ls/#filtering