mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
Update dependency: docker/docker (#2360)
This commit is contained in:
parent
b6b6fd026b
commit
46fff0b544
3 changed files with 10 additions and 8 deletions
|
@ -5,7 +5,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
|
@ -13,6 +12,8 @@ import (
|
|||
"github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/crowdsecurity/go-cs-lib/pkg/ptr"
|
||||
)
|
||||
|
||||
type Container struct {
|
||||
|
@ -139,8 +140,8 @@ func StopContainer(name string) error {
|
|||
return fmt.Errorf("failed to create docker client : %s", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
to := 20 * time.Second
|
||||
if err := cli.ContainerStop(ctx, name, &to); err != nil {
|
||||
to := container.StopOptions{Timeout: ptr.Of(20)}
|
||||
if err := cli.ContainerStop(ctx, name, to); err != nil {
|
||||
return fmt.Errorf("failed while stopping %s : %s", name, err)
|
||||
}
|
||||
log.Printf("container stopped successfully")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue