Switch to container pause/unpause

This commit is contained in:
sfigato 2023-03-14 18:49:58 +01:00
parent 771ed838c6
commit b5fba3dc5b
Signed by: blallo
GPG Key ID: C530464EEDCF489A

View File

@ -8,7 +8,6 @@ import (
"strconv" "strconv"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy" "github.com/docker/docker/pkg/stdcopy"
@ -57,7 +56,7 @@ func (d *DockerContainer) Start(ctx context.Context) error {
return ErrNotRunning return ErrNotRunning
} }
if err = d.client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}); err != nil { if err = d.client.ContainerUnpause(ctx, c.ID); err != nil {
d.logger.Err(map[string]any{ d.logger.Err(map[string]any{
"msg": "Cannot start container", "msg": "Cannot start container",
"err": err.Error(), "err": err.Error(),
@ -78,7 +77,7 @@ func (d *DockerContainer) Stop(ctx context.Context) error {
return ErrNotRunning return ErrNotRunning
} }
if err = d.client.ContainerStop(ctx, c.ID, container.StopOptions{}); err != nil { if err = d.client.ContainerPause(ctx, c.ID); err != nil {
d.logger.Err(map[string]any{ d.logger.Err(map[string]any{
"msg": "Cannot stop container", "msg": "Cannot stop container",
"err": err.Error(), "err": err.Error(),