Skip to content

Commit

Permalink
compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vmorganp committed Mar 26, 2024
1 parent 8a687e6 commit 6cec389
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (lg LazyGroup) MainLoop() {

func (lg LazyGroup) getContainers() []types.Container {
filter := filters.NewArgs(filters.Arg("label", "lazytainer.group="+lg.groupName))
containers, err := dockerClient.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: filter})
containers, err := dockerClient.ContainerList(context.Background(), container.ListOptions{All: true, Filters: filter})
check(err)

return containers
Expand Down Expand Up @@ -103,7 +103,7 @@ func (lg LazyGroup) startContainers() {
debugLogger.Println("starting container(s)")
for _, c := range lg.getContainers() {
if lg.sleepMethod == "stop" || lg.sleepMethod == "" {
if err := dockerClient.ContainerStart(context.Background(), c.ID, types.ContainerStartOptions{}); err != nil {
if err := dockerClient.ContainerStart(context.Background(), c.ID, container.StartOptions{}); err != nil {
fmt.Printf("ERROR: Unable to start container %s: %s\n", c.Names[0], err)
} else {
infoLogger.Println("started container ", c.Names[0])
Expand Down
8 changes: 4 additions & 4 deletions src/lazytainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package main

import (
"context"
"io/ioutil"
"io"
"log"
"os"
"strconv"
"strings"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
)
Expand All @@ -26,7 +26,7 @@ func main() {
// if the verbose flag isn't set to true, don't log debug logs
verbose, verboseFlagSet := os.LookupEnv("VERBOSE")
if !verboseFlagSet || strings.ToLower(verbose) != "true" {
debugLogger.SetOutput(ioutil.Discard)
debugLogger.SetOutput(io.Discard)
}

// configure groups. eventually it might be nice to have file based config as well.
Expand All @@ -53,7 +53,7 @@ func configureFromLabels() map[string]LazyGroup {
dockerClient.NegotiateAPIVersion(context.Background())

filter := filters.NewArgs(filters.Arg("id", container_id))
containers, err := dockerClient.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: filter})
containers, err := dockerClient.ContainerList(context.Background(), container.ListOptions{All: true, Filters: filter})
check(err)

groups := make(map[string]LazyGroup)
Expand Down

0 comments on commit 6cec389

Please sign in to comment.