From 7ccf0172f2ce2fafd3352da83559640efd0308da Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 2 Feb 2023 11:18:33 -0800 Subject: [PATCH] always pass 'nil' platform to ContainerCreate 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. --- agent/dockerclient/dockerapi/docker_client.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agent/dockerclient/dockerapi/docker_client.go b/agent/dockerclient/dockerapi/docker_client.go index 53318362efb..3b54db73364 100644 --- a/agent/dockerclient/dockerapi/docker_client.go +++ b/agent/dockerclient/dockerapi/docker_client.go @@ -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 ( @@ -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}} }