Skip to content

Commit

Permalink
Removed usage of deprecated docker container types
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolamicela authored and orlangure committed May 14, 2024
1 parent 6bb416a commit 4dc3b8c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 39 deletions.
10 changes: 5 additions & 5 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (d *docker) startContainer(ctx context.Context, image string, ports NamedPo

sidecarChan := d.setupContainerCleanup(resp.ID, cfg)

err = d.client.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
err = d.client.ContainerStart(ctx, resp.ID, container.StartOptions{})
if err != nil {
return nil, fmt.Errorf("can't start container %s: %w", resp.ID, err)
}
Expand Down Expand Up @@ -348,7 +348,7 @@ func (d *docker) createContainer(
if len(matches) == 2 {
d.log.Infow("duplicate container found, stopping", "container", matches[1])

err = d.client.ContainerRemove(ctx, matches[1], types.ContainerRemoveOptions{
err = d.client.ContainerRemove(ctx, matches[1], container.RemoveOptions{
Force: true,
})
if err != nil {
Expand All @@ -371,7 +371,7 @@ func (d *docker) findReusableContainer(
return nil, false, fmt.Errorf("container name is required when container reuse is enabled")
}

list, err := d.client.ContainerList(ctx, types.ContainerListOptions{
list, err := d.client.ContainerList(ctx, container.ListOptions{
Filters: filters.NewArgs(
filters.Arg("name", cfg.ContainerName),
filters.Arg("ancestor", image),
Expand Down Expand Up @@ -422,7 +422,7 @@ func (d *docker) boundNamedPorts(json types.ContainerJSON, namedPorts NamedPorts
func (d *docker) readLogs(ctx context.Context, id string) (io.ReadCloser, error) {
d.log.Info("starting container logs forwarder")

logsOptions := types.ContainerLogsOptions{
logsOptions := container.LogsOptions{
ShowStderr: true, ShowStdout: true, Follow: true,
}

Expand Down Expand Up @@ -456,7 +456,7 @@ func (d *docker) removeContainer(ctx context.Context, id string) error {
d.lock.Lock()
defer d.lock.Unlock()

err := d.client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
err := d.client.ContainerRemove(ctx, id, container.RemoveOptions{Force: true})
if err != nil && !client.IsErrNotFound(err) && !isDeletionAlreadyInProgessError(err, id) {
return fmt.Errorf("can't remove container %s: %w", id, err)
}
Expand Down
32 changes: 21 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/aws/aws-sdk-go v1.44.332
github.com/bradfitz/gomemcache v0.0.0-20230611145640-acc696258285
github.com/denisenkom/go-mssqldb v0.12.3
github.com/docker/docker v24.0.5+incompatible
github.com/docker/docker v26.1.0+incompatible
github.com/docker/go-connections v0.4.0
github.com/elastic/go-elasticsearch/v7 v7.17.10
github.com/elastic/go-elasticsearch/v8 v8.9.0
Expand All @@ -27,7 +27,7 @@ require (
github.com/morikuni/aec v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/segmentio/kafka-go v0.4.42
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
go.mongodb.org/mongo-driver v1.12.1
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.25.0
Expand All @@ -46,14 +46,17 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.10.1 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/elastic/elastic-transport-go/v8 v8.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
Expand All @@ -62,7 +65,7 @@ require (
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -82,6 +85,7 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
Expand All @@ -97,15 +101,21 @@ require (
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.13.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 4dc3b8c

Please sign in to comment.