Skip to content

Commit

Permalink
always pass 'nil' platform to ContainerCreate
Browse files Browse the repository at this point in the history
Passing nil to ContainerCreate means that the client library will ignore
this arg and not pass it in the list of arguments it submits to the
docker API.

see https://github.com/moby/moby/blob/4c0d75bc8e8311407040ae7c930f5a2c2c9c03aa/client/container_create.go#L49

We don't want to pass the platform arg because we are not using it and
this is the simplest way to ensure continued support of older docker
versions.
  • Loading branch information
sparrc committed Mar 2, 2023
1 parent 007e6c0 commit 7ccf017
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions agent/dockerclient/dockerapi/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/volume"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
)

const (
Expand Down Expand Up @@ -575,7 +574,7 @@ func (dg *dockerGoClient) createContainer(ctx context.Context,
return DockerContainerMetadata{Error: CannotGetDockerClientError{version: dg.version, err: err}}
}

dockerContainer, err := client.ContainerCreate(ctx, config, hostConfig, &network.NetworkingConfig{}, &v1.Platform{}, name)
dockerContainer, err := client.ContainerCreate(ctx, config, hostConfig, &network.NetworkingConfig{}, nil, name)
if err != nil {
return DockerContainerMetadata{Error: CannotCreateContainerError{err}}
}
Expand Down

0 comments on commit 7ccf017

Please sign in to comment.