From 7bce33eb0fe3a7e1bddfecf71888869c4b699d22 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 25 Aug 2023 23:44:29 +0200 Subject: [PATCH] api/types: move ContainerStartOptions to api/types/container Signed-off-by: Sebastiaan van Stijn --- api/types/client.go | 6 ----- api/types/container/options.go | 6 +++++ api/types/types_deprecated.go | 5 ++++ client/container_start.go | 4 +-- client/container_start_test.go | 6 ++--- client/interface.go | 2 +- integration-cli/docker_api_containers_test.go | 8 +++--- .../docker_api_containers_windows_test.go | 3 +-- integration/container/checkpoint_test.go | 4 +-- integration/container/create_test.go | 26 +++++++++---------- integration/container/daemon_linux_test.go | 4 +-- integration/container/devices_windows_test.go | 3 +-- integration/container/ipcmode_linux_test.go | 11 ++++---- integration/container/mounts_linux_test.go | 3 +-- integration/container/pidmode_linux_test.go | 6 ++--- integration/container/rename_test.go | 2 +- integration/container/restart_test.go | 3 +-- integration/container/wait_test.go | 3 +-- integration/internal/container/container.go | 4 +-- integration/plugin/logging/read_test.go | 2 +- integration/service/network_test.go | 8 +++--- .../system/cgroupdriver_systemd_test.go | 3 +-- testutil/fakestorage/storage.go | 2 +- 23 files changed, 60 insertions(+), 64 deletions(-) diff --git a/api/types/client.go b/api/types/client.go index 36ed5cc29d..a832b60e72 100644 --- a/api/types/client.go +++ b/api/types/client.go @@ -43,12 +43,6 @@ type ContainerLogsOptions struct { Details bool } -// ContainerStartOptions holds parameters to start containers. -type ContainerStartOptions struct { - CheckpointID string - CheckpointDir string -} - // CopyToContainerOptions holds information // about files to copy into a container type CopyToContainerOptions struct { diff --git a/api/types/container/options.go b/api/types/container/options.go index 56ed925d42..1952a20614 100644 --- a/api/types/container/options.go +++ b/api/types/container/options.go @@ -34,3 +34,9 @@ type RemoveOptions struct { RemoveLinks bool Force bool } + +// StartOptions holds parameters to start containers. +type StartOptions struct { + CheckpointID string + CheckpointDir string +} diff --git a/api/types/types_deprecated.go b/api/types/types_deprecated.go index a528097ea8..1fdffe7091 100644 --- a/api/types/types_deprecated.go +++ b/api/types/types_deprecated.go @@ -92,6 +92,11 @@ type ServiceCreateResponse = swarm.ServiceCreateResponse // Deprecated: use [swarm.ServiceUpdateResponse]. type ServiceUpdateResponse = swarm.ServiceUpdateResponse +// ContainerStartOptions holds parameters to start containers. +// +// Deprecated: use [container.StartOptions]. +type ContainerStartOptions = container.StartOptions + // ResizeOptions holds parameters to resize a TTY. // It can be used to resize container TTYs and // exec process TTYs too. diff --git a/client/container_start.go b/client/container_start.go index c2e0b15dca..33ba85f248 100644 --- a/client/container_start.go +++ b/client/container_start.go @@ -4,11 +4,11 @@ import ( "context" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" ) // ContainerStart sends a request to the docker daemon to start a container. -func (cli *Client) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error { +func (cli *Client) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error { query := url.Values{} if len(options.CheckpointID) != 0 { query.Set("checkpoint", options.CheckpointID) diff --git a/client/container_start_test.go b/client/container_start_test.go index 18b100ae11..d4d0fd16bc 100644 --- a/client/container_start_test.go +++ b/client/container_start_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/errdefs" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -20,7 +20,7 @@ func TestContainerStartError(t *testing.T) { client := &Client{ client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), } - err := client.ContainerStart(context.Background(), "nothing", types.ContainerStartOptions{}) + err := client.ContainerStart(context.Background(), "nothing", container.StartOptions{}) assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) } @@ -51,7 +51,7 @@ func TestContainerStart(t *testing.T) { }), } - err := client.ContainerStart(context.Background(), "container_id", types.ContainerStartOptions{CheckpointID: "checkpoint_id"}) + err := client.ContainerStart(context.Background(), "container_id", container.StartOptions{CheckpointID: "checkpoint_id"}) if err != nil { t.Fatal(err) } diff --git a/client/interface.go b/client/interface.go index 712e925e5b..2185c357a6 100644 --- a/client/interface.go +++ b/client/interface.go @@ -69,7 +69,7 @@ type ContainerAPIClient interface { ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error) ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error) ContainerStatsOneShot(ctx context.Context, container string) (types.ContainerStats, error) - ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error + ContainerStart(ctx context.Context, container string, options container.StartOptions) error ContainerStop(ctx context.Context, container string, options container.StopOptions) error ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error) ContainerUnpause(ctx context.Context, container string) error diff --git a/integration-cli/docker_api_containers_test.go b/integration-cli/docker_api_containers_test.go index 72dc6d3cfe..a8f02a8ff7 100644 --- a/integration-cli/docker_api_containers_test.go +++ b/integration-cli/docker_api_containers_test.go @@ -924,12 +924,12 @@ func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) { _, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name) assert.NilError(c, err) - err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{}) assert.NilError(c, err) // second call to start should give 304 // maybe add ContainerStartWithRaw to test it - err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{}) assert.NilError(c, err) // TODO(tibor): figure out why this doesn't work on windows @@ -1572,7 +1572,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) _, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name) assert.NilError(c, err) - err = apiClient.ContainerStart(testutil.GetContext(c), name, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{}) assert.NilError(c, err) assert.Assert(c, waitRun(name) == nil) @@ -2112,7 +2112,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) { assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode)) assert.Check(c, is.Equal(x.expected.Destination, mountPoint.Destination)) - err = apiclient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{}) + err = apiclient.ContainerStart(ctx, ctr.ID, container.StartOptions{}) assert.NilError(c, err) poll.WaitOn(c, containerExit(ctx, apiclient, ctr.ID), poll.WithDelay(time.Second)) diff --git a/integration-cli/docker_api_containers_windows_test.go b/integration-cli/docker_api_containers_windows_test.go index d19865265c..4c0be31e4f 100644 --- a/integration-cli/docker_api_containers_windows_test.go +++ b/integration-cli/docker_api_containers_windows_test.go @@ -10,7 +10,6 @@ import ( "testing" winio "github.com/Microsoft/go-winio" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/mount" "github.com/docker/docker/testutil" @@ -66,7 +65,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T nil, nil, name) assert.NilError(c, err) - err = client.ContainerStart(ctx, name, types.ContainerStartOptions{}) + err = client.ContainerStart(ctx, name, container.StartOptions{}) assert.NilError(c, err) err = <-ch diff --git a/integration/container/checkpoint_test.go b/integration/container/checkpoint_test.go index 63795ce596..359e8c421c 100644 --- a/integration/container/checkpoint_test.go +++ b/integration/container/checkpoint_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/checkpoint" + containertypes "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" "github.com/docker/docker/client" "github.com/docker/docker/integration/internal/container" @@ -128,7 +128,7 @@ func TestCheckpoint(t *testing.T) { // Restore the container from a second checkpoint. t.Log("Restore the container") - err = apiClient.ContainerStart(ctx, cID, types.ContainerStartOptions{ + err = apiClient.ContainerStart(ctx, cID, containertypes.StartOptions{ CheckpointID: "test2", }) assert.NilError(t, err) diff --git a/integration/container/create_test.go b/integration/container/create_test.go index fed5980a97..7dd2b4993e 100644 --- a/integration/container/create_test.go +++ b/integration/container/create_test.go @@ -8,9 +8,7 @@ import ( "testing" "time" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" @@ -253,7 +251,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) { checkInspect(t, ctx, name, tc.expected) // Start the container. - err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{}) assert.NilError(t, err) poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond)) @@ -331,7 +329,7 @@ func TestCreateWithCustomReadonlyPaths(t *testing.T) { checkInspect(t, ctx, name, tc.expected) // Start the container. - err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{}) assert.NilError(t, err) poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond)) @@ -436,7 +434,7 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) { ) defer func() { - err := apiClient.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true}) + err := apiClient.ContainerRemove(ctx, id, container.RemoveOptions{Force: true}) assert.NilError(t, err) }() @@ -447,7 +445,7 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) { assert.Assert(t, is.Len(inspect.Mounts, 0)) chWait, chErr := apiClient.ContainerWait(ctx, id, container.WaitConditionNextExit) - assert.NilError(t, apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})) + assert.NilError(t, apiClient.ContainerStart(ctx, id, container.StartOptions{})) timeout := time.NewTimer(30 * time.Second) defer timeout.Stop() @@ -483,7 +481,7 @@ func TestCreateDifferentPlatform(t *testing.T) { Architecture: img.Architecture, Variant: img.Variant, } - _, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "") + _, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "") assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) }) t.Run("different cpu arch", func(t *testing.T) { @@ -493,7 +491,7 @@ func TestCreateDifferentPlatform(t *testing.T) { Architecture: img.Architecture + "DifferentArch", Variant: img.Variant, } - _, err := apiClient.ContainerCreate(ctx, &containertypes.Config{Image: "busybox:latest"}, &containertypes.HostConfig{}, nil, &p, "") + _, err := apiClient.ContainerCreate(ctx, &container.Config{Image: "busybox:latest"}, &container.HostConfig{}, nil, &p, "") assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) }) } @@ -541,32 +539,32 @@ func TestCreateInvalidHostConfig(t *testing.T) { testCases := []struct { doc string - hc containertypes.HostConfig + hc container.HostConfig expectedErr string }{ { doc: "invalid IpcMode", - hc: containertypes.HostConfig{IpcMode: "invalid"}, + hc: container.HostConfig{IpcMode: "invalid"}, expectedErr: "Error response from daemon: invalid IPC mode: invalid", }, { doc: "invalid PidMode", - hc: containertypes.HostConfig{PidMode: "invalid"}, + hc: container.HostConfig{PidMode: "invalid"}, expectedErr: "Error response from daemon: invalid PID mode: invalid", }, { doc: "invalid PidMode without container ID", - hc: containertypes.HostConfig{PidMode: "container"}, + hc: container.HostConfig{PidMode: "container"}, expectedErr: "Error response from daemon: invalid PID mode: container", }, { doc: "invalid UTSMode", - hc: containertypes.HostConfig{UTSMode: "invalid"}, + hc: container.HostConfig{UTSMode: "invalid"}, expectedErr: "Error response from daemon: invalid UTS mode: invalid", }, { doc: "invalid Annotations", - hc: containertypes.HostConfig{Annotations: map[string]string{"": "a"}}, + hc: container.HostConfig{Annotations: map[string]string{"": "a"}}, expectedErr: "Error response from daemon: invalid Annotations: the empty string is not permitted as an annotation key", }, } diff --git a/integration/container/daemon_linux_test.go b/integration/container/daemon_linux_test.go index 8f5f6f84e9..41bddd96f9 100644 --- a/integration/container/daemon_linux_test.go +++ b/integration/container/daemon_linux_test.go @@ -49,7 +49,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) { cID := container.Create(ctx, t, c) defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true}) - err := c.ContainerStart(ctx, cID, types.ContainerStartOptions{}) + err := c.ContainerStart(ctx, cID, containertypes.StartOptions{}) assert.Check(t, err, "error starting test container") inspect, err := c.ContainerInspect(ctx, cID) @@ -68,7 +68,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) { d.Start(t, "--iptables=false") - err = c.ContainerStart(ctx, cID, types.ContainerStartOptions{}) + err = c.ContainerStart(ctx, cID, containertypes.StartOptions{}) assert.Check(t, err, "failed to start test container") } diff --git a/integration/container/devices_windows_test.go b/integration/container/devices_windows_test.go index 7c3f7f959a..a1f6446f80 100644 --- a/integration/container/devices_windows_test.go +++ b/integration/container/devices_windows_test.go @@ -4,7 +4,6 @@ import ( "strings" "testing" - "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/testutil" @@ -100,7 +99,7 @@ func TestWindowsDevices(t *testing.T) { // remove this skip.If and validate the expected behaviour under Hyper-V. skip.If(t, d.isolation == containertypes.IsolationHyperV && !d.expectedStartFailure, "FIXME. HyperV isolation setup is probably incorrect in the test") - err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{}) + err := apiClient.ContainerStart(ctx, id, containertypes.StartOptions{}) if d.expectedStartFailure { assert.ErrorContains(t, err, d.expectedStartFailureMessage) return diff --git a/integration/container/ipcmode_linux_test.go b/integration/container/ipcmode_linux_test.go index 99224a6364..9e7f28fa07 100644 --- a/integration/container/ipcmode_linux_test.go +++ b/integration/container/ipcmode_linux_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" - "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" @@ -68,7 +67,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool, assert.NilError(t, err) assert.Check(t, is.Equal(len(resp.Warnings), 0)) - err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, resp.ID, containertypes.StartOptions{}) assert.NilError(t, err) // get major:minor pair for /dev/shm from container's /proc/self/mountinfo @@ -140,7 +139,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) { assert.Check(t, is.Equal(len(resp.Warnings), 0)) name1 := resp.ID - err = apiClient.ContainerStart(ctx, name1, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, name1, containertypes.StartOptions{}) assert.NilError(t, err) // create and start the second container @@ -150,7 +149,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) { assert.Check(t, is.Equal(len(resp.Warnings), 0)) name2 := resp.ID - err = apiClient.ContainerStart(ctx, name2, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, name2, containertypes.StartOptions{}) if !mustWork { // start should fail with a specific error assert.Check(t, is.ErrorContains(err, "non-shareable IPC")) @@ -206,7 +205,7 @@ func TestAPIIpcModeHost(t *testing.T) { assert.Check(t, is.Equal(len(resp.Warnings), 0)) name := resp.ID - err = apiClient.ContainerStart(ctx, name, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, name, containertypes.StartOptions{}) assert.NilError(t, err) // check that IPC is shared @@ -241,7 +240,7 @@ func testDaemonIpcPrivateShareable(t *testing.T, mustBeShared bool, arg ...strin assert.NilError(t, err) assert.Check(t, is.Equal(len(resp.Warnings), 0)) - err = c.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}) + err = c.ContainerStart(ctx, resp.ID, containertypes.StartOptions{}) assert.NilError(t, err) // get major:minor pair for /dev/shm from container's /proc/self/mountinfo diff --git a/integration/container/mounts_linux_test.go b/integration/container/mounts_linux_test.go index 49f6019943..07078ca12e 100644 --- a/integration/container/mounts_linux_test.go +++ b/integration/container/mounts_linux_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" @@ -67,7 +66,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) { ctrCreate, err := cli.ContainerCreate(ctx, &config, &hostConfig, &network.NetworkingConfig{}, nil, "") assert.NilError(t, err) // container will exit immediately because of no tty, but we only need the start sequence to test the condition - err = cli.ContainerStart(ctx, ctrCreate.ID, types.ContainerStartOptions{}) + err = cli.ContainerStart(ctx, ctrCreate.ID, containertypes.StartOptions{}) assert.NilError(t, err) // Check that host-located bind mount network file did not change ownership when the container was started diff --git a/integration/container/pidmode_linux_test.go b/integration/container/pidmode_linux_test.go index 728ac1969d..ba0182da8c 100644 --- a/integration/container/pidmode_linux_test.go +++ b/integration/container/pidmode_linux_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/docker/docker/api/types" + containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/errdefs" "github.com/docker/docker/integration/internal/container" "gotest.tools/v3/assert" @@ -50,7 +50,7 @@ func TestPIDModeContainer(t *testing.T) { ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName))) assert.NilError(t, err, "should not produce an error when creating, only when starting") - err = apiClient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{}) assert.Check(t, is.ErrorType(err, errdefs.IsSystem), "should produce a System error when starting an existing container from an invalid state") assert.Check(t, is.ErrorContains(err, "failed to join PID namespace")) assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running")) @@ -63,7 +63,7 @@ func TestPIDModeContainer(t *testing.T) { ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName))) assert.NilError(t, err) - err = apiClient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{}) assert.Check(t, err) }) } diff --git a/integration/container/rename_test.go b/integration/container/rename_test.go index c9c1a1b63d..93a1e864bc 100644 --- a/integration/container/rename_test.go +++ b/integration/container/rename_test.go @@ -135,7 +135,7 @@ func TestRenameAnonymousContainer(t *testing.T) { // FIXME(vdemeester) this is a really weird behavior as it fails otherwise err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{}) assert.NilError(t, err) - err = apiClient.ContainerStart(ctx, container1Name, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, container1Name, containertypes.StartOptions{}) assert.NilError(t, err) count := "-c" diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go index 19fb06c832..56695a0e75 100644 --- a/integration/container/restart_test.go +++ b/integration/container/restart_test.go @@ -6,7 +6,6 @@ import ( "testing" "time" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/client" testContainer "github.com/docker/docker/integration/internal/container" @@ -105,7 +104,7 @@ func TestDaemonRestartKillContainers(t *testing.T) { defer apiClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true}) if tc.xStart { - err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, resp.ID, container.StartOptions{}) assert.NilError(t, err) } diff --git a/integration/container/wait_test.go b/integration/container/wait_test.go index 082ef49b1b..f530549e1d 100644 --- a/integration/container/wait_test.go +++ b/integration/container/wait_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/testutil" @@ -149,7 +148,7 @@ func TestWaitConditions(t *testing.T) { assert.NilError(t, err) defer streams.Close() - assert.NilError(t, cli.ContainerStart(ctx, containerID, types.ContainerStartOptions{})) + assert.NilError(t, cli.ContainerStart(ctx, containerID, containertypes.StartOptions{})) waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond) select { case err := <-errC: diff --git a/integration/internal/container/container.go b/integration/internal/container/container.go index fb22b3de55..0974ce6bf1 100644 --- a/integration/internal/container/container.go +++ b/integration/internal/container/container.go @@ -77,7 +77,7 @@ func Run(ctx context.Context, t *testing.T, apiClient client.APIClient, ops ...f t.Helper() id := Create(ctx, t, apiClient, ops...) - err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{}) + err := apiClient.ContainerStart(ctx, id, container.StartOptions{}) assert.NilError(t, err) return id @@ -106,7 +106,7 @@ func RunAttach(ctx context.Context, t *testing.T, apiClient client.APIClient, op }) assert.NilError(t, err) - err = apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{}) + err = apiClient.ContainerStart(ctx, id, container.StartOptions{}) assert.NilError(t, err) s, err := demultiplexStreams(ctx, aresp) diff --git a/integration/plugin/logging/read_test.go b/integration/plugin/logging/read_test.go index b28af7d96d..ea61d50a9d 100644 --- a/integration/plugin/logging/read_test.go +++ b/integration/plugin/logging/read_test.go @@ -62,7 +62,7 @@ func TestReadPluginNoRead(t *testing.T) { assert.Assert(t, err) defer client.ContainerRemove(ctx, c.ID, container.RemoveOptions{Force: true}) - err = client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}) + err = client.ContainerStart(ctx, c.ID, container.StartOptions{}) assert.Assert(t, err) logs, err := client.ContainerLogs(ctx, c.ID, types.ContainerLogsOptions{ShowStdout: true}) diff --git a/integration/service/network_test.go b/integration/service/network_test.go index c3e407967c..d1fb6372f0 100644 --- a/integration/service/network_test.go +++ b/integration/service/network_test.go @@ -3,7 +3,7 @@ package service // import "github.com/docker/docker/integration/service" import ( "testing" - "github.com/docker/docker/api/types" + containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/integration/internal/container" net "github.com/docker/docker/integration/internal/network" @@ -43,7 +43,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) { }) assert.NilError(t, err) - err = client.ContainerStart(ctx, cID1, types.ContainerStartOptions{}) + err = client.ContainerStart(ctx, cID1, containertypes.StartOptions{}) assert.NilError(t, err) ng1, err := client.ContainerInspect(ctx, cID1) @@ -66,7 +66,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) { }) assert.NilError(t, err) - err = client.ContainerStart(ctx, cID2, types.ContainerStartOptions{}) + err = client.ContainerStart(ctx, cID2, containertypes.StartOptions{}) assert.NilError(t, err) ng2, err := client.ContainerInspect(ctx, cID2) @@ -101,7 +101,7 @@ func TestDockerNetworkReConnect(t *testing.T) { err := client.NetworkConnect(ctx, name, c1, &network.EndpointSettings{}) assert.NilError(t, err) - err = client.ContainerStart(ctx, c1, types.ContainerStartOptions{}) + err = client.ContainerStart(ctx, c1, containertypes.StartOptions{}) assert.NilError(t, err) n1, err := client.ContainerInspect(ctx, c1) diff --git a/integration/system/cgroupdriver_systemd_test.go b/integration/system/cgroupdriver_systemd_test.go index 6479d84a72..98eef0dbc0 100644 --- a/integration/system/cgroupdriver_systemd_test.go +++ b/integration/system/cgroupdriver_systemd_test.go @@ -4,7 +4,6 @@ import ( "os" "testing" - "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/integration/internal/container" "github.com/docker/docker/testutil" @@ -48,7 +47,7 @@ func TestCgroupDriverSystemdMemoryLimit(t *testing.T) { }) defer c.ContainerRemove(ctx, ctrID, containertypes.RemoveOptions{Force: true}) - err := c.ContainerStart(ctx, ctrID, types.ContainerStartOptions{}) + err := c.ContainerStart(ctx, ctrID, containertypes.StartOptions{}) assert.NilError(t, err) s, err := c.ContainerInspect(ctx, ctrID) diff --git a/testutil/fakestorage/storage.go b/testutil/fakestorage/storage.go index 75f429c93c..0a67b9c50a 100644 --- a/testutil/fakestorage/storage.go +++ b/testutil/fakestorage/storage.go @@ -157,7 +157,7 @@ COPY . /static`); err != nil { Image: image, }, &containertypes.HostConfig{}, nil, nil, container) assert.NilError(t, err) - err = c.ContainerStart(context.Background(), b.ID, types.ContainerStartOptions{}) + err = c.ContainerStart(context.Background(), b.ID, containertypes.StartOptions{}) assert.NilError(t, err) // Find out the system assigned port