Skip to content

Commit

Permalink
Refer to correct package for container.Listoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonPi committed Jun 15, 2024
1 parent 23b65d3 commit ba284c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ufwhandler/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import (
"context"

"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"
"github.com/rs/zerolog/log"
)

// Sync retrieves all running containers
func Sync(ctx *context.Context, createChannel chan *types.ContainerJSON, client *client.Client) {
// Returns only running containers
filter := filters.NewArgs()
filter.Add("label", "UFW_MANAGED=TRUE")
containers, err := client.ContainerList(*ctx, types.ContainerListOptions{Filters: filter})
containers, err := client.ContainerList(*ctx, container.ListOptions{Filters: filter})
if err != nil {
log.Error().Err(err).Msg("ufw-docker-automated: Couldn't retrieve existing containers.")
}
Expand Down

0 comments on commit ba284c3

Please sign in to comment.