瀏覽代碼

Merge pull request #46483 from thaJeztah/api_move_image_types

api/types: move various types to api/types/(images|containers|swarm)
Sebastiaan van Stijn 1 年之前
父節點
當前提交
0a82696d70
共有 100 個文件被更改,包括 588 次插入466 次删除
  1. 2 2
      api/server/httputils/write_log_stream.go
  2. 2 2
      api/server/router/container/backend.go
  3. 2 2
      api/server/router/container/container_routes.go
  4. 2 2
      api/server/router/image/backend.go
  5. 1 1
      api/server/router/image/image_routes.go
  6. 26 25
      api/server/router/swarm/backend.go
  7. 3 2
      api/server/router/swarm/helpers.go
  8. 28 13
      api/swagger.yaml
  9. 0 73
      api/types/client.go
  10. 67 0
      api/types/container/options.go
  11. 4 4
      api/types/image/delete_response.go
  12. 9 0
      api/types/image/image.go
  13. 4 4
      api/types/image/summary.go
  14. 20 0
      api/types/swarm/service_create_response.go
  15. 1 1
      api/types/swarm/service_update_response.go
  16. 4 9
      api/types/types.go
  17. 66 0
      api/types/types_deprecated.go
  18. 4 4
      client/client.go
  19. 2 1
      client/container_attach.go
  20. 2 1
      client/container_commit.go
  21. 3 2
      client/container_commit_test.go
  22. 2 1
      client/container_list.go
  23. 3 2
      client/container_list_test.go
  24. 2 2
      client/container_logs.go
  25. 13 13
      client/container_logs_test.go
  26. 2 2
      client/container_remove.go
  27. 4 4
      client/container_remove_test.go
  28. 3 3
      client/container_resize.go
  29. 5 5
      client/container_resize_test.go
  30. 2 2
      client/container_start.go
  31. 3 3
      client/container_start_test.go
  32. 3 2
      client/image_list.go
  33. 3 2
      client/image_list_test.go
  34. 2 1
      client/image_prune_test.go
  35. 3 2
      client/image_remove.go
  36. 2 1
      client/image_remove_test.go
  37. 14 14
      client/interface.go
  38. 2 2
      client/request_test.go
  39. 2 2
      client/service_create.go
  40. 3 3
      client/service_create_test.go
  41. 2 2
      client/service_logs.go
  42. 9 9
      client/service_logs_test.go
  43. 2 2
      client/service_update.go
  44. 2 2
      client/task_logs.go
  45. 2 2
      daemon/cluster/executor/backend.go
  46. 1 1
      daemon/cluster/executor/container/adapter.go
  47. 8 7
      daemon/cluster/services.go
  48. 2 1
      daemon/cluster/swarm.go
  49. 10 10
      daemon/containerd/image_delete.go
  50. 5 5
      daemon/containerd/image_list.go
  51. 3 2
      daemon/containerd/image_prune.go
  52. 3 2
      daemon/daemon.go
  53. 6 4
      daemon/disk_usage.go
  54. 2 2
      daemon/image_service.go
  55. 10 16
      daemon/images/image_delete.go
  56. 7 7
      daemon/images/image_list.go
  57. 2 1
      daemon/images/image_prune.go
  58. 18 17
      daemon/list.go
  59. 5 5
      daemon/list_test.go
  60. 1 2
      daemon/logs.go
  61. 11 4
      hack/generate-swagger-api.sh
  62. 2 1
      integration-cli/docker_api_attach_test.go
  63. 15 15
      integration-cli/docker_api_containers_test.go
  64. 1 2
      integration-cli/docker_api_containers_windows_test.go
  65. 14 10
      integration-cli/docker_api_logs_test.go
  66. 2 2
      integration-cli/docker_cli_events_test.go
  67. 2 1
      integration/build/build_squash_test.go
  68. 2 1
      integration/build/build_test.go
  69. 2 1
      integration/build/build_userns_linux_test.go
  70. 2 1
      integration/capabilities/capabilities_linux_test.go
  71. 3 3
      integration/container/attach_test.go
  72. 2 3
      integration/container/cdi_test.go
  73. 2 2
      integration/container/checkpoint_test.go
  74. 12 14
      integration/container/create_test.go
  75. 7 7
      integration/container/daemon_linux_test.go
  76. 2 2
      integration/container/daemon_test.go
  77. 1 2
      integration/container/devices_windows_test.go
  78. 5 6
      integration/container/ipcmode_linux_test.go
  79. 2 2
      integration/container/links_linux_test.go
  80. 10 10
      integration/container/logs_test.go
  81. 2 3
      integration/container/mounts_linux_test.go
  82. 2 2
      integration/container/nat_test.go
  83. 3 3
      integration/container/pidmode_linux_test.go
  84. 3 2
      integration/container/ps_test.go
  85. 6 6
      integration/container/remove_test.go
  86. 2 2
      integration/container/rename_test.go
  87. 3 3
      integration/container/resize_test.go
  88. 3 4
      integration/container/restart_test.go
  89. 4 5
      integration/container/run_linux_test.go
  90. 1 2
      integration/container/stop_linux_test.go
  91. 3 4
      integration/container/wait_test.go
  92. 7 7
      integration/daemon/daemon_test.go
  93. 3 3
      integration/image/commit_test.go
  94. 2 1
      integration/image/list_test.go
  95. 3 2
      integration/image/remove_test.go
  96. 4 4
      integration/image/save_test.go
  97. 4 4
      integration/internal/container/container.go
  98. 2 2
      integration/network/dns_test.go
  99. 5 4
      integration/network/network_test.go
  100. 2 1
      integration/plugin/authz/authz_plugin_test.go

+ 2 - 2
api/server/httputils/write_log_stream.go

@@ -7,8 +7,8 @@ import (
 	"net/url"
 	"net/url"
 	"sort"
 	"sort"
 
 
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/pkg/ioutils"
 	"github.com/docker/docker/pkg/ioutils"
 	"github.com/docker/docker/pkg/jsonmessage"
 	"github.com/docker/docker/pkg/jsonmessage"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
@@ -16,7 +16,7 @@ import (
 
 
 // WriteLogStream writes an encoded byte stream of log messages from the
 // WriteLogStream writes an encoded byte stream of log messages from the
 // messages channel, multiplexing them with a stdcopy.Writer if mux is true
 // messages channel, multiplexing them with a stdcopy.Writer if mux is true
-func WriteLogStream(_ context.Context, w io.Writer, msgs <-chan *backend.LogMessage, config *types.ContainerLogsOptions, mux bool) {
+func WriteLogStream(_ context.Context, w io.Writer, msgs <-chan *backend.LogMessage, config *container.LogsOptions, mux bool) {
 	wf := ioutils.NewWriteFlusher(w)
 	wf := ioutils.NewWriteFlusher(w)
 	defer wf.Close()
 	defer wf.Close()
 
 

+ 2 - 2
api/server/router/container/backend.go

@@ -50,10 +50,10 @@ type stateBackend interface {
 type monitorBackend interface {
 type monitorBackend interface {
 	ContainerChanges(ctx context.Context, name string) ([]archive.Change, error)
 	ContainerChanges(ctx context.Context, name string) ([]archive.Change, error)
 	ContainerInspect(ctx context.Context, name string, size bool, version string) (interface{}, error)
 	ContainerInspect(ctx context.Context, name string, size bool, version string) (interface{}, error)
-	ContainerLogs(ctx context.Context, name string, config *types.ContainerLogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
+	ContainerLogs(ctx context.Context, name string, config *container.LogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
 	ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
 	ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error
 	ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
 	ContainerTop(name string, psArgs string) (*container.ContainerTopOKBody, error)
-	Containers(ctx context.Context, config *types.ContainerListOptions) ([]*types.Container, error)
+	Containers(ctx context.Context, config *container.ListOptions) ([]*types.Container, error)
 }
 }
 
 
 // attachBackend includes function to implement to provide container attaching functionality.
 // attachBackend includes function to implement to provide container attaching functionality.

+ 2 - 2
api/server/router/container/container_routes.go

@@ -78,7 +78,7 @@ func (s *containerRouter) getContainersJSON(ctx context.Context, w http.Response
 		return err
 		return err
 	}
 	}
 
 
-	config := &types.ContainerListOptions{
+	config := &container.ListOptions{
 		All:     httputils.BoolValue(r, "all"),
 		All:     httputils.BoolValue(r, "all"),
 		Size:    httputils.BoolValue(r, "size"),
 		Size:    httputils.BoolValue(r, "size"),
 		Since:   r.Form.Get("since"),
 		Since:   r.Form.Get("since"),
@@ -142,7 +142,7 @@ func (s *containerRouter) getContainersLogs(ctx context.Context, w http.Response
 	}
 	}
 
 
 	containerName := vars["name"]
 	containerName := vars["name"]
-	logsConfig := &types.ContainerLogsOptions{
+	logsConfig := &container.LogsOptions{
 		Follow:     httputils.BoolValue(r, "follow"),
 		Follow:     httputils.BoolValue(r, "follow"),
 		Timestamps: httputils.BoolValue(r, "timestamps"),
 		Timestamps: httputils.BoolValue(r, "timestamps"),
 		Since:      r.Form.Get("since"),
 		Since:      r.Form.Get("since"),

+ 2 - 2
api/server/router/image/backend.go

@@ -22,9 +22,9 @@ type Backend interface {
 }
 }
 
 
 type imageBackend interface {
 type imageBackend interface {
-	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
+	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]image.DeleteResponse, error)
 	ImageHistory(ctx context.Context, imageName string) ([]*image.HistoryResponseItem, error)
 	ImageHistory(ctx context.Context, imageName string) ([]*image.HistoryResponseItem, error)
-	Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
+	Images(ctx context.Context, opts types.ImageListOptions) ([]*image.Summary, error)
 	GetImage(ctx context.Context, refOrID string, options image.GetImageOpts) (*dockerimage.Image, error)
 	GetImage(ctx context.Context, refOrID string, options image.GetImageOpts) (*dockerimage.Image, error)
 	TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error
 	TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error
 	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
 	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)

+ 1 - 1
api/server/router/image/image_routes.go

@@ -353,7 +353,7 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er
 			Data: img.Details.Metadata,
 			Data: img.Details.Metadata,
 		},
 		},
 		RootFS: rootFSToAPIType(img.RootFS),
 		RootFS: rootFSToAPIType(img.RootFS),
-		Metadata: types.ImageMetadata{
+		Metadata: opts.Metadata{
 			LastTagTime: img.Details.LastUpdated,
 			LastTagTime: img.Details.LastUpdated,
 		},
 		},
 	}, nil
 	}, nil

+ 26 - 25
api/server/router/swarm/backend.go

@@ -3,40 +3,41 @@ package swarm // import "github.com/docker/docker/api/server/router/swarm"
 import (
 import (
 	"context"
 	"context"
 
 
-	basictypes "github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
-	types "github.com/docker/docker/api/types/swarm"
+	"github.com/docker/docker/api/types/container"
+	"github.com/docker/docker/api/types/swarm"
 )
 )
 
 
 // Backend abstracts a swarm manager.
 // Backend abstracts a swarm manager.
 type Backend interface {
 type Backend interface {
-	Init(req types.InitRequest) (string, error)
-	Join(req types.JoinRequest) error
+	Init(req swarm.InitRequest) (string, error)
+	Join(req swarm.JoinRequest) error
 	Leave(ctx context.Context, force bool) error
 	Leave(ctx context.Context, force bool) error
-	Inspect() (types.Swarm, error)
-	Update(uint64, types.Spec, types.UpdateFlags) error
+	Inspect() (swarm.Swarm, error)
+	Update(uint64, swarm.Spec, swarm.UpdateFlags) error
 	GetUnlockKey() (string, error)
 	GetUnlockKey() (string, error)
-	UnlockSwarm(req types.UnlockRequest) error
-	GetServices(basictypes.ServiceListOptions) ([]types.Service, error)
-	GetService(idOrName string, insertDefaults bool) (types.Service, error)
-	CreateService(types.ServiceSpec, string, bool) (*basictypes.ServiceCreateResponse, error)
-	UpdateService(string, uint64, types.ServiceSpec, basictypes.ServiceUpdateOptions, bool) (*basictypes.ServiceUpdateResponse, error)
+	UnlockSwarm(req swarm.UnlockRequest) error
+	GetServices(types.ServiceListOptions) ([]swarm.Service, error)
+	GetService(idOrName string, insertDefaults bool) (swarm.Service, error)
+	CreateService(swarm.ServiceSpec, string, bool) (*swarm.ServiceCreateResponse, error)
+	UpdateService(string, uint64, swarm.ServiceSpec, types.ServiceUpdateOptions, bool) (*swarm.ServiceUpdateResponse, error)
 	RemoveService(string) error
 	RemoveService(string) error
-	ServiceLogs(context.Context, *backend.LogSelector, *basictypes.ContainerLogsOptions) (<-chan *backend.LogMessage, error)
-	GetNodes(basictypes.NodeListOptions) ([]types.Node, error)
-	GetNode(string) (types.Node, error)
-	UpdateNode(string, uint64, types.NodeSpec) error
+	ServiceLogs(context.Context, *backend.LogSelector, *container.LogsOptions) (<-chan *backend.LogMessage, error)
+	GetNodes(types.NodeListOptions) ([]swarm.Node, error)
+	GetNode(string) (swarm.Node, error)
+	UpdateNode(string, uint64, swarm.NodeSpec) error
 	RemoveNode(string, bool) error
 	RemoveNode(string, bool) error
-	GetTasks(basictypes.TaskListOptions) ([]types.Task, error)
-	GetTask(string) (types.Task, error)
-	GetSecrets(opts basictypes.SecretListOptions) ([]types.Secret, error)
-	CreateSecret(s types.SecretSpec) (string, error)
+	GetTasks(types.TaskListOptions) ([]swarm.Task, error)
+	GetTask(string) (swarm.Task, error)
+	GetSecrets(opts types.SecretListOptions) ([]swarm.Secret, error)
+	CreateSecret(s swarm.SecretSpec) (string, error)
 	RemoveSecret(idOrName string) error
 	RemoveSecret(idOrName string) error
-	GetSecret(id string) (types.Secret, error)
-	UpdateSecret(idOrName string, version uint64, spec types.SecretSpec) error
-	GetConfigs(opts basictypes.ConfigListOptions) ([]types.Config, error)
-	CreateConfig(s types.ConfigSpec) (string, error)
+	GetSecret(id string) (swarm.Secret, error)
+	UpdateSecret(idOrName string, version uint64, spec swarm.SecretSpec) error
+	GetConfigs(opts types.ConfigListOptions) ([]swarm.Config, error)
+	CreateConfig(s swarm.ConfigSpec) (string, error)
 	RemoveConfig(id string) error
 	RemoveConfig(id string) error
-	GetConfig(id string) (types.Config, error)
-	UpdateConfig(idOrName string, version uint64, spec types.ConfigSpec) error
+	GetConfig(id string) (swarm.Config, error)
+	UpdateConfig(idOrName string, version uint64, spec swarm.ConfigSpec) error
 }
 }

+ 3 - 2
api/server/router/swarm/helpers.go

@@ -8,6 +8,7 @@ import (
 	"github.com/docker/docker/api/server/httputils"
 	"github.com/docker/docker/api/server/httputils"
 	basictypes "github.com/docker/docker/api/types"
 	basictypes "github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 )
 )
@@ -25,9 +26,9 @@ func (sr *swarmRouter) swarmLogs(ctx context.Context, w http.ResponseWriter, r *
 		return fmt.Errorf("Bad parameters: you must choose at least one stream")
 		return fmt.Errorf("Bad parameters: you must choose at least one stream")
 	}
 	}
 
 
-	// there is probably a neater way to manufacture the ContainerLogsOptions
+	// there is probably a neater way to manufacture the LogsOptions
 	// struct, probably in the caller, to eliminate the dependency on net/http
 	// struct, probably in the caller, to eliminate the dependency on net/http
-	logsConfig := &basictypes.ContainerLogsOptions{
+	logsConfig := &container.LogsOptions{
 		Follow:     httputils.BoolValue(r, "follow"),
 		Follow:     httputils.BoolValue(r, "follow"),
 		Timestamps: httputils.BoolValue(r, "timestamps"),
 		Timestamps: httputils.BoolValue(r, "timestamps"),
 		Since:      r.Form.Get("since"),
 		Since:      r.Form.Get("since"),

+ 28 - 13
api/swagger.yaml

@@ -1840,6 +1840,7 @@ definitions:
             x-nullable: true
             x-nullable: true
   ImageSummary:
   ImageSummary:
     type: "object"
     type: "object"
+    x-go-name: "Summary"
     required:
     required:
       - Id
       - Id
       - ParentId
       - ParentId
@@ -4477,6 +4478,7 @@ definitions:
 
 
   ImageDeleteResponseItem:
   ImageDeleteResponseItem:
     type: "object"
     type: "object"
+    x-go-name: "DeleteResponse"
     properties:
     properties:
       Untagged:
       Untagged:
         description: "The image ID of an image that was untagged"
         description: "The image ID of an image that was untagged"
@@ -4485,6 +4487,29 @@ definitions:
         description: "The image ID of an image that was deleted"
         description: "The image ID of an image that was deleted"
         type: "string"
         type: "string"
 
 
+  ServiceCreateResponse:
+    type: "object"
+    description: |
+      contains the information returned to a client on the
+      creation of a new service.
+    properties:
+      ID:
+        description: "The ID of the created service."
+        type: "string"
+        x-nullable: false
+        example: "ak7w3gjqoa3kuz8xcpnyy0pvl"
+      Warnings:
+        description: |
+          Optional warning message.
+
+          FIXME(thaJeztah): this should have "omitempty" in the generated type.
+        type: "array"
+        x-nullable: true
+        items:
+          type: "string"
+        example:
+          - "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
+
   ServiceUpdateResponse:
   ServiceUpdateResponse:
     type: "object"
     type: "object"
     properties:
     properties:
@@ -4494,7 +4519,8 @@ definitions:
         items:
         items:
           type: "string"
           type: "string"
     example:
     example:
-      Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
+      Warnings:
+        - "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
 
 
   ContainerSummary:
   ContainerSummary:
     type: "object"
     type: "object"
@@ -11097,18 +11123,7 @@ paths:
         201:
         201:
           description: "no error"
           description: "no error"
           schema:
           schema:
-            type: "object"
-            title: "ServiceCreateResponse"
-            properties:
-              ID:
-                description: "The ID of the created service."
-                type: "string"
-              Warning:
-                description: "Optional warning message"
-                type: "string"
-            example:
-              ID: "ak7w3gjqoa3kuz8xcpnyy0pvl"
-              Warning: "unable to pin image doesnotexist:latest to digest: image library/doesnotexist:latest not found"
+            $ref: "#/definitions/ServiceCreateResponse"
         400:
         400:
           description: "bad parameter"
           description: "bad parameter"
           schema:
           schema:

+ 0 - 73
api/types/client.go

@@ -11,26 +11,6 @@ import (
 	units "github.com/docker/go-units"
 	units "github.com/docker/go-units"
 )
 )
 
 
-// ContainerAttachOptions holds parameters to attach to a container.
-type ContainerAttachOptions struct {
-	Stream     bool
-	Stdin      bool
-	Stdout     bool
-	Stderr     bool
-	DetachKeys string
-	Logs       bool
-}
-
-// ContainerCommitOptions holds parameters to commit changes into a container.
-type ContainerCommitOptions struct {
-	Reference string
-	Comment   string
-	Author    string
-	Changes   []string
-	Pause     bool
-	Config    *container.Config
-}
-
 // ContainerExecInspect holds information returned by exec inspect.
 // ContainerExecInspect holds information returned by exec inspect.
 type ContainerExecInspect struct {
 type ContainerExecInspect struct {
 	ExecID      string `json:"ID"`
 	ExecID      string `json:"ID"`
@@ -40,42 +20,6 @@ type ContainerExecInspect struct {
 	Pid         int
 	Pid         int
 }
 }
 
 
-// ContainerListOptions holds parameters to list containers with.
-type ContainerListOptions struct {
-	Size    bool
-	All     bool
-	Latest  bool
-	Since   string
-	Before  string
-	Limit   int
-	Filters filters.Args
-}
-
-// ContainerLogsOptions holds parameters to filter logs with.
-type ContainerLogsOptions struct {
-	ShowStdout bool
-	ShowStderr bool
-	Since      string
-	Until      string
-	Timestamps bool
-	Follow     bool
-	Tail       string
-	Details    bool
-}
-
-// ContainerRemoveOptions holds parameters to remove containers.
-type ContainerRemoveOptions struct {
-	RemoveVolumes bool
-	RemoveLinks   bool
-	Force         bool
-}
-
-// ContainerStartOptions holds parameters to start containers.
-type ContainerStartOptions struct {
-	CheckpointID  string
-	CheckpointDir string
-}
-
 // CopyToContainerOptions holds information
 // CopyToContainerOptions holds information
 // about files to copy into a container
 // about files to copy into a container
 type CopyToContainerOptions struct {
 type CopyToContainerOptions struct {
@@ -289,14 +233,6 @@ type ImageSearchOptions struct {
 	Limit         int
 	Limit         int
 }
 }
 
 
-// ResizeOptions holds parameters to resize a tty.
-// It can be used to resize container ttys and
-// exec process ttys too.
-type ResizeOptions struct {
-	Height uint
-	Width  uint
-}
-
 // NodeListOptions holds parameters to list nodes with.
 // NodeListOptions holds parameters to list nodes with.
 type NodeListOptions struct {
 type NodeListOptions struct {
 	Filters filters.Args
 	Filters filters.Args
@@ -322,15 +258,6 @@ type ServiceCreateOptions struct {
 	QueryRegistry bool
 	QueryRegistry bool
 }
 }
 
 
-// ServiceCreateResponse contains the information returned to a client
-// on the creation of a new service.
-type ServiceCreateResponse struct {
-	// ID is the ID of the created service.
-	ID string
-	// Warnings is a set of non-fatal warning messages to pass on to the user.
-	Warnings []string `json:",omitempty"`
-}
-
 // Values for RegistryAuthFrom in ServiceUpdateOptions
 // Values for RegistryAuthFrom in ServiceUpdateOptions
 const (
 const (
 	RegistryAuthFromSpec         = "spec"
 	RegistryAuthFromSpec         = "spec"

+ 67 - 0
api/types/container/options.go

@@ -0,0 +1,67 @@
+package container
+
+import "github.com/docker/docker/api/types/filters"
+
+// ResizeOptions holds parameters to resize a TTY.
+// It can be used to resize container TTYs and
+// exec process TTYs too.
+type ResizeOptions struct {
+	Height uint
+	Width  uint
+}
+
+// AttachOptions holds parameters to attach to a container.
+type AttachOptions struct {
+	Stream     bool
+	Stdin      bool
+	Stdout     bool
+	Stderr     bool
+	DetachKeys string
+	Logs       bool
+}
+
+// CommitOptions holds parameters to commit changes into a container.
+type CommitOptions struct {
+	Reference string
+	Comment   string
+	Author    string
+	Changes   []string
+	Pause     bool
+	Config    *Config
+}
+
+// RemoveOptions holds parameters to remove containers.
+type RemoveOptions struct {
+	RemoveVolumes bool
+	RemoveLinks   bool
+	Force         bool
+}
+
+// StartOptions holds parameters to start containers.
+type StartOptions struct {
+	CheckpointID  string
+	CheckpointDir string
+}
+
+// ListOptions holds parameters to list containers with.
+type ListOptions struct {
+	Size    bool
+	All     bool
+	Latest  bool
+	Since   string
+	Before  string
+	Limit   int
+	Filters filters.Args
+}
+
+// LogsOptions holds parameters to filter logs with.
+type LogsOptions struct {
+	ShowStdout bool
+	ShowStderr bool
+	Since      string
+	Until      string
+	Timestamps bool
+	Follow     bool
+	Tail       string
+	Details    bool
+}

+ 4 - 4
api/types/image_delete_response_item.go → api/types/image/delete_response.go

@@ -1,11 +1,11 @@
-package types
+package image
 
 
 // This file was generated by the swagger tool.
 // This file was generated by the swagger tool.
 // Editing this file might prove futile when you re-run the swagger generate command
 // Editing this file might prove futile when you re-run the swagger generate command
 
 
-// ImageDeleteResponseItem image delete response item
-// swagger:model ImageDeleteResponseItem
-type ImageDeleteResponseItem struct {
+// DeleteResponse delete response
+// swagger:model DeleteResponse
+type DeleteResponse struct {
 
 
 	// The image ID of an image that was deleted
 	// The image ID of an image that was deleted
 	Deleted string `json:"Deleted,omitempty"`
 	Deleted string `json:"Deleted,omitempty"`

+ 9 - 0
api/types/image/image.go

@@ -0,0 +1,9 @@
+package image
+
+import "time"
+
+// Metadata contains engine-local data about the image.
+type Metadata struct {
+	// LastTagTime is the date and time at which the image was last tagged.
+	LastTagTime time.Time `json:",omitempty"`
+}

+ 4 - 4
api/types/image_summary.go → api/types/image/summary.go

@@ -1,11 +1,11 @@
-package types
+package image
 
 
 // This file was generated by the swagger tool.
 // This file was generated by the swagger tool.
 // Editing this file might prove futile when you re-run the swagger generate command
 // Editing this file might prove futile when you re-run the swagger generate command
 
 
-// ImageSummary image summary
-// swagger:model ImageSummary
-type ImageSummary struct {
+// Summary summary
+// swagger:model Summary
+type Summary struct {
 
 
 	// Number of containers using this image. Includes both stopped and running
 	// Number of containers using this image. Includes both stopped and running
 	// containers.
 	// containers.

+ 20 - 0
api/types/swarm/service_create_response.go

@@ -0,0 +1,20 @@
+package swarm
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// ServiceCreateResponse contains the information returned to a client on the
+// creation of a new service.
+//
+// swagger:model ServiceCreateResponse
+type ServiceCreateResponse struct {
+
+	// The ID of the created service.
+	ID string `json:"ID,omitempty"`
+
+	// Optional warning message.
+	//
+	// FIXME(thaJeztah): this should have "omitempty" in the generated type.
+	//
+	Warnings []string `json:"Warnings"`
+}

+ 1 - 1
api/types/service_update_response.go → api/types/swarm/service_update_response.go

@@ -1,4 +1,4 @@
-package types
+package swarm
 
 
 // This file was generated by the swagger tool.
 // This file was generated by the swagger tool.
 // Editing this file might prove futile when you re-run the swagger generate command
 // Editing this file might prove futile when you re-run the swagger generate command

+ 4 - 9
api/types/types.go

@@ -7,6 +7,7 @@ import (
 
 
 	"github.com/docker/docker/api/types/container"
 	"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/api/types/image"
 	"github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
@@ -128,13 +129,7 @@ type ImageInspect struct {
 	// Metadata of the image in the local cache.
 	// Metadata of the image in the local cache.
 	//
 	//
 	// This information is local to the daemon, and not part of the image itself.
 	// This information is local to the daemon, and not part of the image itself.
-	Metadata ImageMetadata
-}
-
-// ImageMetadata contains engine-local data about the image
-type ImageMetadata struct {
-	// LastTagTime is the date and time at which the image was last tagged.
-	LastTagTime time.Time `json:",omitempty"`
+	Metadata image.Metadata
 }
 }
 
 
 // Container contains response of Engine API:
 // Container contains response of Engine API:
@@ -514,7 +509,7 @@ type DiskUsageOptions struct {
 // GET "/system/df"
 // GET "/system/df"
 type DiskUsage struct {
 type DiskUsage struct {
 	LayersSize  int64
 	LayersSize  int64
-	Images      []*ImageSummary
+	Images      []*image.Summary
 	Containers  []*Container
 	Containers  []*Container
 	Volumes     []*volume.Volume
 	Volumes     []*volume.Volume
 	BuildCache  []*BuildCache
 	BuildCache  []*BuildCache
@@ -538,7 +533,7 @@ type VolumesPruneReport struct {
 // ImagesPruneReport contains the response for Engine API:
 // ImagesPruneReport contains the response for Engine API:
 // POST "/images/prune"
 // POST "/images/prune"
 type ImagesPruneReport struct {
 type ImagesPruneReport struct {
-	ImagesDeleted  []ImageDeleteResponseItem
+	ImagesDeleted  []image.DeleteResponse
 	SpaceReclaimed uint64
 	SpaceReclaimed uint64
 }
 }
 
 

+ 66 - 0
api/types/types_deprecated.go

@@ -2,6 +2,9 @@ package types
 
 
 import (
 import (
 	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/api/types/checkpoint"
+	"github.com/docker/docker/api/types/container"
+	"github.com/docker/docker/api/types/image"
+	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/system"
 	"github.com/docker/docker/api/types/system"
 )
 )
 
 
@@ -63,6 +66,69 @@ type SecurityOpt = system.SecurityOpt
 // Deprecated: use [system.KeyValue].
 // Deprecated: use [system.KeyValue].
 type KeyValue = system.KeyValue
 type KeyValue = system.KeyValue
 
 
+// ImageDeleteResponseItem image delete response item.
+//
+// Deprecated: use [image.DeleteResponse].
+type ImageDeleteResponseItem = image.DeleteResponse
+
+// ImageSummary image summary.
+//
+// Deprecated: use [image.Summary].
+type ImageSummary = image.Summary
+
+// ImageMetadata contains engine-local data about the image.
+//
+// Deprecated: use [image.Metadata].
+type ImageMetadata = image.Metadata
+
+// ServiceCreateResponse contains the information returned to a client
+// on the creation of a new service.
+//
+// Deprecated: use [swarm.ServiceCreateResponse].
+type ServiceCreateResponse = swarm.ServiceCreateResponse
+
+// ServiceUpdateResponse service update response.
+//
+// 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.
+//
+// Deprecated: use [container.ResizeOptions].
+type ResizeOptions = container.ResizeOptions
+
+// ContainerAttachOptions holds parameters to attach to a container.
+//
+// Deprecated: use [container.AttachOptions].
+type ContainerAttachOptions = container.AttachOptions
+
+// ContainerCommitOptions holds parameters to commit changes into a container.
+//
+// Deprecated: use [container.CommitOptions].
+type ContainerCommitOptions = container.CommitOptions
+
+// ContainerListOptions holds parameters to list containers with.
+//
+// Deprecated: use [container.ListOptions].
+type ContainerListOptions = container.ListOptions
+
+// ContainerLogsOptions holds parameters to filter logs with.
+//
+// Deprecated: use [container.LogsOptions].
+type ContainerLogsOptions = container.LogsOptions
+
+// ContainerRemoveOptions holds parameters to remove containers.
+//
+// Deprecated: use [container.RemoveOptions].
+type ContainerRemoveOptions = container.RemoveOptions
+
 // DecodeSecurityOptions decodes a security options string slice to a type safe
 // DecodeSecurityOptions decodes a security options string slice to a type safe
 // [system.SecurityOpt].
 // [system.SecurityOpt].
 //
 //

+ 4 - 4
client/client.go

@@ -19,7 +19,7 @@ For example, to list running containers (the equivalent of "docker ps"):
 		"context"
 		"context"
 		"fmt"
 		"fmt"
 
 
-		"github.com/docker/docker/api/types"
+		"github.com/docker/docker/api/types/container"
 		"github.com/docker/docker/client"
 		"github.com/docker/docker/client"
 	)
 	)
 
 
@@ -29,13 +29,13 @@ For example, to list running containers (the equivalent of "docker ps"):
 			panic(err)
 			panic(err)
 		}
 		}
 
 
-		containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
+		containers, err := cli.ContainerList(context.Background(), container.ListOptions{})
 		if err != nil {
 		if err != nil {
 			panic(err)
 			panic(err)
 		}
 		}
 
 
-		for _, container := range containers {
-			fmt.Printf("%s %s\n", container.ID[:10], container.Image)
+		for _, ctr := range containers {
+			fmt.Printf("%s %s\n", ctr.ID, ctr.Image)
 		}
 		}
 	}
 	}
 */
 */

+ 2 - 1
client/container_attach.go

@@ -6,6 +6,7 @@ import (
 	"net/url"
 	"net/url"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 )
 )
 
 
 // ContainerAttach attaches a connection to a container in the server.
 // ContainerAttach attaches a connection to a container in the server.
@@ -32,7 +33,7 @@ import (
 //
 //
 // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
 // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
 // stream.
 // stream.
-func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
+func (cli *Client) ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error) {
 	query := url.Values{}
 	query := url.Values{}
 	if options.Stream {
 	if options.Stream {
 		query.Set("stream", "1")
 		query.Set("stream", "1")

+ 2 - 1
client/container_commit.go

@@ -8,10 +8,11 @@ import (
 
 
 	"github.com/distribution/reference"
 	"github.com/distribution/reference"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 )
 )
 
 
 // ContainerCommit applies changes to a container and creates a new tagged image.
 // ContainerCommit applies changes to a container and creates a new tagged image.
-func (cli *Client) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) {
+func (cli *Client) ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error) {
 	var repository, tag string
 	var repository, tag string
 	if options.Reference != "" {
 	if options.Reference != "" {
 		ref, err := reference.ParseNormalizedNamed(options.Reference)
 		ref, err := reference.ParseNormalizedNamed(options.Reference)

+ 3 - 2
client/container_commit_test.go

@@ -11,6 +11,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -20,7 +21,7 @@ func TestContainerCommitError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	_, err := client.ContainerCommit(context.Background(), "nothing", types.ContainerCommitOptions{})
+	_, err := client.ContainerCommit(context.Background(), "nothing", container.CommitOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -81,7 +82,7 @@ func TestContainerCommit(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	r, err := client.ContainerCommit(context.Background(), expectedContainerID, types.ContainerCommitOptions{
+	r, err := client.ContainerCommit(context.Background(), expectedContainerID, container.CommitOptions{
 		Reference: specifiedReference,
 		Reference: specifiedReference,
 		Comment:   expectedComment,
 		Comment:   expectedComment,
 		Author:    expectedAuthor,
 		Author:    expectedAuthor,

+ 2 - 1
client/container_list.go

@@ -7,11 +7,12 @@ 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"
 )
 )
 
 
 // ContainerList returns the list of containers in the docker host.
 // ContainerList returns the list of containers in the docker host.
-func (cli *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
+func (cli *Client) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) {
 	query := url.Values{}
 	query := url.Values{}
 
 
 	if options.All {
 	if options.All {

+ 3 - 2
client/container_list_test.go

@@ -11,6 +11,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"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/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
@@ -21,7 +22,7 @@ func TestContainerListError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	_, err := client.ContainerList(context.Background(), types.ContainerListOptions{})
+	_, err := client.ContainerList(context.Background(), container.ListOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -78,7 +79,7 @@ func TestContainerList(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	containers, err := client.ContainerList(context.Background(), types.ContainerListOptions{
+	containers, err := client.ContainerList(context.Background(), container.ListOptions{
 		Size:  true,
 		Size:  true,
 		All:   true,
 		All:   true,
 		Since: "container",
 		Since: "container",

+ 2 - 2
client/container_logs.go

@@ -6,7 +6,7 @@ import (
 	"net/url"
 	"net/url"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 )
 )
@@ -33,7 +33,7 @@ import (
 //
 //
 // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
 // You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this
 // stream.
 // stream.
-func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
+func (cli *Client) ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) {
 	query := url.Values{}
 	query := url.Values{}
 	if options.ShowStdout {
 	if options.ShowStdout {
 		query.Set("stdout", "1")
 		query.Set("stdout", "1")

+ 13 - 13
client/container_logs_test.go

@@ -12,7 +12,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -22,7 +22,7 @@ func TestContainerLogsNotFoundError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
 		client: newMockClient(errorMock(http.StatusNotFound, "Not found")),
 	}
 	}
-	_, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{})
+	_, err := client.ContainerLogs(context.Background(), "container_id", container.LogsOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 }
 }
 
 
@@ -30,14 +30,14 @@ func TestContainerLogsError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	_, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{})
+	_, err := client.ContainerLogs(context.Background(), "container_id", container.LogsOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 
 
-	_, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{
+	_, err = client.ContainerLogs(context.Background(), "container_id", container.LogsOptions{
 		Since: "2006-01-02TZ",
 		Since: "2006-01-02TZ",
 	})
 	})
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
-	_, err = client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{
+	_, err = client.ContainerLogs(context.Background(), "container_id", container.LogsOptions{
 		Until: "2006-01-02TZ",
 		Until: "2006-01-02TZ",
 	})
 	})
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
@@ -46,7 +46,7 @@ func TestContainerLogsError(t *testing.T) {
 func TestContainerLogs(t *testing.T) {
 func TestContainerLogs(t *testing.T) {
 	expectedURL := "/containers/container_id/logs"
 	expectedURL := "/containers/container_id/logs"
 	cases := []struct {
 	cases := []struct {
-		options             types.ContainerLogsOptions
+		options             container.LogsOptions
 		expectedQueryParams map[string]string
 		expectedQueryParams map[string]string
 		expectedError       string
 		expectedError       string
 	}{
 	}{
@@ -56,7 +56,7 @@ func TestContainerLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				Tail: "any",
 				Tail: "any",
 			},
 			},
 			expectedQueryParams: map[string]string{
 			expectedQueryParams: map[string]string{
@@ -64,7 +64,7 @@ func TestContainerLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: true,
 				ShowStderr: true,
 				Timestamps: true,
 				Timestamps: true,
@@ -81,7 +81,7 @@ func TestContainerLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// timestamp will be passed as is
 				// timestamp will be passed as is
 				Since: "1136073600.000000001",
 				Since: "1136073600.000000001",
 			},
 			},
@@ -91,7 +91,7 @@ func TestContainerLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// timestamp will be passed as is
 				// timestamp will be passed as is
 				Until: "1136073600.000000001",
 				Until: "1136073600.000000001",
 			},
 			},
@@ -101,14 +101,14 @@ func TestContainerLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// An complete invalid date will not be passed
 				// An complete invalid date will not be passed
 				Since: "invalid value",
 				Since: "invalid value",
 			},
 			},
 			expectedError: `invalid value for "since": failed to parse value as time or duration: "invalid value"`,
 			expectedError: `invalid value for "since": failed to parse value as time or duration: "invalid value"`,
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// An complete invalid date will not be passed
 				// An complete invalid date will not be passed
 				Until: "invalid value",
 				Until: "invalid value",
 			},
 			},
@@ -153,7 +153,7 @@ func ExampleClient_ContainerLogs_withTimeout() {
 	defer cancel()
 	defer cancel()
 
 
 	client, _ := NewClientWithOpts(FromEnv)
 	client, _ := NewClientWithOpts(FromEnv)
-	reader, err := client.ContainerLogs(ctx, "container_id", types.ContainerLogsOptions{})
+	reader, err := client.ContainerLogs(ctx, "container_id", container.LogsOptions{})
 	if err != nil {
 	if err != nil {
 		log.Fatal(err)
 		log.Fatal(err)
 	}
 	}

+ 2 - 2
client/container_remove.go

@@ -4,11 +4,11 @@ import (
 	"context"
 	"context"
 	"net/url"
 	"net/url"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 )
 )
 
 
 // ContainerRemove kills and removes a container from the docker host.
 // ContainerRemove kills and removes a container from the docker host.
-func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error {
+func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error {
 	query := url.Values{}
 	query := url.Values{}
 	if options.RemoveVolumes {
 	if options.RemoveVolumes {
 		query.Set("v", "1")
 		query.Set("v", "1")

+ 4 - 4
client/container_remove_test.go

@@ -9,7 +9,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -19,7 +19,7 @@ func TestContainerRemoveError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{})
+	err := client.ContainerRemove(context.Background(), "container_id", container.RemoveOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -27,7 +27,7 @@ func TestContainerRemoveNotFoundError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusNotFound, "no such container: container_id")),
 		client: newMockClient(errorMock(http.StatusNotFound, "no such container: container_id")),
 	}
 	}
-	err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{})
+	err := client.ContainerRemove(context.Background(), "container_id", container.RemoveOptions{})
 	assert.Check(t, is.ErrorContains(err, "no such container: container_id"))
 	assert.Check(t, is.ErrorContains(err, "no such container: container_id"))
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 }
 }
@@ -59,7 +59,7 @@ func TestContainerRemove(t *testing.T) {
 		}),
 		}),
 	}
 	}
 
 
-	err := client.ContainerRemove(context.Background(), "container_id", types.ContainerRemoveOptions{
+	err := client.ContainerRemove(context.Background(), "container_id", container.RemoveOptions{
 		RemoveVolumes: true,
 		RemoveVolumes: true,
 		Force:         true,
 		Force:         true,
 	})
 	})

+ 3 - 3
client/container_resize.go

@@ -5,16 +5,16 @@ import (
 	"net/url"
 	"net/url"
 	"strconv"
 	"strconv"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 )
 )
 
 
 // ContainerResize changes the size of the tty for a container.
 // ContainerResize changes the size of the tty for a container.
-func (cli *Client) ContainerResize(ctx context.Context, containerID string, options types.ResizeOptions) error {
+func (cli *Client) ContainerResize(ctx context.Context, containerID string, options container.ResizeOptions) error {
 	return cli.resize(ctx, "/containers/"+containerID, options.Height, options.Width)
 	return cli.resize(ctx, "/containers/"+containerID, options.Height, options.Width)
 }
 }
 
 
 // ContainerExecResize changes the size of the tty for an exec process running inside a container.
 // ContainerExecResize changes the size of the tty for an exec process running inside a container.
-func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error {
+func (cli *Client) ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error {
 	return cli.resize(ctx, "/exec/"+execID, options.Height, options.Width)
 	return cli.resize(ctx, "/exec/"+execID, options.Height, options.Width)
 }
 }
 
 

+ 5 - 5
client/container_resize_test.go

@@ -9,7 +9,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -19,7 +19,7 @@ func TestContainerResizeError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	err := client.ContainerResize(context.Background(), "container_id", types.ResizeOptions{})
+	err := client.ContainerResize(context.Background(), "container_id", container.ResizeOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -27,7 +27,7 @@ func TestContainerExecResizeError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	err := client.ContainerExecResize(context.Background(), "exec_id", types.ResizeOptions{})
+	err := client.ContainerExecResize(context.Background(), "exec_id", container.ResizeOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 
@@ -36,7 +36,7 @@ func TestContainerResize(t *testing.T) {
 		client: newMockClient(resizeTransport("/containers/container_id/resize")),
 		client: newMockClient(resizeTransport("/containers/container_id/resize")),
 	}
 	}
 
 
-	err := client.ContainerResize(context.Background(), "container_id", types.ResizeOptions{
+	err := client.ContainerResize(context.Background(), "container_id", container.ResizeOptions{
 		Height: 500,
 		Height: 500,
 		Width:  600,
 		Width:  600,
 	})
 	})
@@ -50,7 +50,7 @@ func TestContainerExecResize(t *testing.T) {
 		client: newMockClient(resizeTransport("/exec/exec_id/resize")),
 		client: newMockClient(resizeTransport("/exec/exec_id/resize")),
 	}
 	}
 
 
-	err := client.ContainerExecResize(context.Background(), "exec_id", types.ResizeOptions{
+	err := client.ContainerExecResize(context.Background(), "exec_id", container.ResizeOptions{
 		Height: 500,
 		Height: 500,
 		Width:  600,
 		Width:  600,
 	})
 	})

+ 2 - 2
client/container_start.go

@@ -4,11 +4,11 @@ import (
 	"context"
 	"context"
 	"net/url"
 	"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.
 // 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{}
 	query := url.Values{}
 	if len(options.CheckpointID) != 0 {
 	if len(options.CheckpointID) != 0 {
 		query.Set("checkpoint", options.CheckpointID)
 		query.Set("checkpoint", options.CheckpointID)

+ 3 - 3
client/container_start_test.go

@@ -10,7 +10,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -20,7 +20,7 @@ func TestContainerStartError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		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))
 	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 {
 	if err != nil {
 		t.Fatal(err)
 		t.Fatal(err)
 	}
 	}

+ 3 - 2
client/image_list.go

@@ -7,11 +7,12 @@ import (
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 )
 )
 
 
 // ImageList returns a list of images in the docker host.
 // ImageList returns a list of images in the docker host.
-func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {
+func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) {
 	// Make sure we negotiated (if the client is configured to do so),
 	// Make sure we negotiated (if the client is configured to do so),
 	// as code below contains API-version specific handling of options.
 	// as code below contains API-version specific handling of options.
 	//
 	//
@@ -19,7 +20,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions
 	// the API request is made.
 	// the API request is made.
 	cli.checkVersion(ctx)
 	cli.checkVersion(ctx)
 
 
-	var images []types.ImageSummary
+	var images []image.Summary
 	query := url.Values{}
 	query := url.Values{}
 
 
 	optionFilters := options.Filters
 	optionFilters := options.Filters

+ 3 - 2
client/image_list_test.go

@@ -13,6 +13,7 @@ import (
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -80,7 +81,7 @@ func TestImageList(t *testing.T) {
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 					}
 					}
 				}
 				}
-				content, err := json.Marshal([]types.ImageSummary{
+				content, err := json.Marshal([]image.Summary{
 					{
 					{
 						ID: "image_id2",
 						ID: "image_id2",
 					},
 					},
@@ -121,7 +122,7 @@ func TestImageListApiBefore125(t *testing.T) {
 			if actualFilters != "" {
 			if actualFilters != "" {
 				return nil, fmt.Errorf("filters should have not been present, were with value: %s", actualFilters)
 				return nil, fmt.Errorf("filters should have not been present, were with value: %s", actualFilters)
 			}
 			}
-			content, err := json.Marshal([]types.ImageSummary{
+			content, err := json.Marshal([]image.Summary{
 				{
 				{
 					ID: "image_id2",
 					ID: "image_id2",
 				},
 				},

+ 2 - 1
client/image_prune_test.go

@@ -10,6 +10,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
@@ -84,7 +85,7 @@ func TestImagesPrune(t *testing.T) {
 					assert.Check(t, is.Equal(expected, actual))
 					assert.Check(t, is.Equal(expected, actual))
 				}
 				}
 				content, err := json.Marshal(types.ImagesPruneReport{
 				content, err := json.Marshal(types.ImagesPruneReport{
-					ImagesDeleted: []types.ImageDeleteResponseItem{
+					ImagesDeleted: []image.DeleteResponse{
 						{
 						{
 							Deleted: "image_id1",
 							Deleted: "image_id1",
 						},
 						},

+ 3 - 2
client/image_remove.go

@@ -6,10 +6,11 @@ import (
 	"net/url"
 	"net/url"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 )
 )
 
 
 // ImageRemove removes an image from the docker host.
 // ImageRemove removes an image from the docker host.
-func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
+func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
 	query := url.Values{}
 	query := url.Values{}
 
 
 	if options.Force {
 	if options.Force {
@@ -19,7 +20,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type
 		query.Set("noprune", "1")
 		query.Set("noprune", "1")
 	}
 	}
 
 
-	var dels []types.ImageDeleteResponseItem
+	var dels []image.DeleteResponse
 	resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
 	resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
 	defer ensureReaderClosed(resp)
 	defer ensureReaderClosed(resp)
 	if err != nil {
 	if err != nil {

+ 2 - 1
client/image_remove_test.go

@@ -11,6 +11,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -74,7 +75,7 @@ func TestImageRemove(t *testing.T) {
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 						return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
 					}
 					}
 				}
 				}
-				b, err := json.Marshal([]types.ImageDeleteResponseItem{
+				b, err := json.Marshal([]image.DeleteResponse{
 					{
 					{
 						Untagged: "image_id1",
 						Untagged: "image_id1",
 					},
 					},

+ 14 - 14
client/interface.go

@@ -46,30 +46,30 @@ type CommonAPIClient interface {
 
 
 // ContainerAPIClient defines API client methods for the containers
 // ContainerAPIClient defines API client methods for the containers
 type ContainerAPIClient interface {
 type ContainerAPIClient interface {
-	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
-	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
+	ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
+	ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (types.IDResponse, error)
 	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
 	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
 	ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
 	ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
 	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
-	ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error
+	ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
 	ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
 	ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
 	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
 	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
 	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
 	ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
 	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
 	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (types.ContainerJSON, []byte, error)
 	ContainerKill(ctx context.Context, container, signal string) error
 	ContainerKill(ctx context.Context, container, signal string) error
-	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
-	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
+	ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
+	ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error)
 	ContainerPause(ctx context.Context, container string) error
 	ContainerPause(ctx context.Context, container string) error
-	ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
+	ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error
 	ContainerRename(ctx context.Context, container, newContainerName string) error
 	ContainerRename(ctx context.Context, container, newContainerName string) error
-	ContainerResize(ctx context.Context, container string, options types.ResizeOptions) error
+	ContainerResize(ctx context.Context, container string, options container.ResizeOptions) error
 	ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
 	ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
 	ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
 	ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error)
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
 	ContainerStats(ctx context.Context, container string, stream bool) (types.ContainerStats, error)
 	ContainerStatsOneShot(ctx context.Context, container string) (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
 	ContainerStop(ctx context.Context, container string, options container.StopOptions) error
 	ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
 	ContainerTop(ctx context.Context, container string, arguments []string) (container.ContainerTopOKBody, error)
 	ContainerUnpause(ctx context.Context, container string) error
 	ContainerUnpause(ctx context.Context, container string) error
@@ -94,11 +94,11 @@ type ImageAPIClient interface {
 	ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
 	ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
 	ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
 	ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
-	ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
+	ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error)
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
 	ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
 	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
 	ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
-	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
+	ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
 	ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
 	ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
 	ImageTag(ctx context.Context, image, ref string) error
 	ImageTag(ctx context.Context, image, ref string) error
@@ -141,13 +141,13 @@ type PluginAPIClient interface {
 
 
 // ServiceAPIClient defines API client methods for the services
 // ServiceAPIClient defines API client methods for the services
 type ServiceAPIClient interface {
 type ServiceAPIClient interface {
-	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
+	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error)
 	ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
 	ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
 	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
 	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
 	ServiceRemove(ctx context.Context, serviceID string) error
 	ServiceRemove(ctx context.Context, serviceID string) error
-	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
-	ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
-	TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error)
+	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
+	ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error)
+	TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error)
 	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
 	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
 	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
 	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
 }
 }

+ 2 - 2
client/request_test.go

@@ -12,7 +12,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -90,7 +90,7 @@ func TestPlainTextError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(plainTextErrorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(plainTextErrorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	_, err := client.ContainerList(context.Background(), types.ContainerListOptions{})
+	_, err := client.ContainerList(context.Background(), container.ListOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 }
 }
 
 

+ 2 - 2
client/service_create.go

@@ -17,8 +17,8 @@ import (
 )
 )
 
 
 // ServiceCreate creates a new service.
 // ServiceCreate creates a new service.
-func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error) {
-	var response types.ServiceCreateResponse
+func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) {
+	var response swarm.ServiceCreateResponse
 
 
 	// Make sure we negotiated (if the client is configured to do so),
 	// Make sure we negotiated (if the client is configured to do so),
 	// as code below contains API-version specific handling of options.
 	// as code below contains API-version specific handling of options.

+ 3 - 3
client/service_create_test.go

@@ -38,7 +38,7 @@ func TestServiceCreate(t *testing.T) {
 			if req.Method != http.MethodPost {
 			if req.Method != http.MethodPost {
 				return nil, fmt.Errorf("expected POST method, got %s", req.Method)
 				return nil, fmt.Errorf("expected POST method, got %s", req.Method)
 			}
 			}
-			b, err := json.Marshal(types.ServiceCreateResponse{
+			b, err := json.Marshal(swarm.ServiceCreateResponse{
 				ID: "service_id",
 				ID: "service_id",
 			})
 			})
 			if err != nil {
 			if err != nil {
@@ -77,7 +77,7 @@ func TestServiceCreateCompatiblePlatforms(t *testing.T) {
 				assert.Check(t, is.Len(serviceSpec.TaskTemplate.Placement.Platforms, 1))
 				assert.Check(t, is.Len(serviceSpec.TaskTemplate.Placement.Platforms, 1))
 
 
 				p := serviceSpec.TaskTemplate.Placement.Platforms[0]
 				p := serviceSpec.TaskTemplate.Placement.Platforms[0]
-				b, err := json.Marshal(types.ServiceCreateResponse{
+				b, err := json.Marshal(swarm.ServiceCreateResponse{
 					ID: "service_" + p.OS + "_" + p.Architecture,
 					ID: "service_" + p.OS + "_" + p.Architecture,
 				})
 				})
 				if err != nil {
 				if err != nil {
@@ -153,7 +153,7 @@ func TestServiceCreateDigestPinning(t *testing.T) {
 				}
 				}
 				serviceCreateImage = service.TaskTemplate.ContainerSpec.Image
 				serviceCreateImage = service.TaskTemplate.ContainerSpec.Image
 
 
-				b, err := json.Marshal(types.ServiceCreateResponse{
+				b, err := json.Marshal(swarm.ServiceCreateResponse{
 					ID: "service_id",
 					ID: "service_id",
 				})
 				})
 				if err != nil {
 				if err != nil {

+ 2 - 2
client/service_logs.go

@@ -6,14 +6,14 @@ import (
 	"net/url"
 	"net/url"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 )
 )
 
 
 // ServiceLogs returns the logs generated by a service in an io.ReadCloser.
 // ServiceLogs returns the logs generated by a service in an io.ReadCloser.
 // It's up to the caller to close the stream.
 // It's up to the caller to close the stream.
-func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
+func (cli *Client) ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error) {
 	query := url.Values{}
 	query := url.Values{}
 	if options.ShowStdout {
 	if options.ShowStdout {
 		query.Set("stdout", "1")
 		query.Set("stdout", "1")

+ 9 - 9
client/service_logs_test.go

@@ -12,7 +12,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
@@ -22,10 +22,10 @@ func TestServiceLogsError(t *testing.T) {
 	client := &Client{
 	client := &Client{
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 		client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
 	}
 	}
-	_, err := client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{})
+	_, err := client.ServiceLogs(context.Background(), "service_id", container.LogsOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 	assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
 
 
-	_, err = client.ServiceLogs(context.Background(), "service_id", types.ContainerLogsOptions{
+	_, err = client.ServiceLogs(context.Background(), "service_id", container.LogsOptions{
 		Since: "2006-01-02TZ",
 		Since: "2006-01-02TZ",
 	})
 	})
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
 	assert.Check(t, is.ErrorContains(err, `parsing time "2006-01-02TZ"`))
@@ -34,7 +34,7 @@ func TestServiceLogsError(t *testing.T) {
 func TestServiceLogs(t *testing.T) {
 func TestServiceLogs(t *testing.T) {
 	expectedURL := "/services/service_id/logs"
 	expectedURL := "/services/service_id/logs"
 	cases := []struct {
 	cases := []struct {
-		options             types.ContainerLogsOptions
+		options             container.LogsOptions
 		expectedQueryParams map[string]string
 		expectedQueryParams map[string]string
 		expectedError       string
 		expectedError       string
 	}{
 	}{
@@ -44,7 +44,7 @@ func TestServiceLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				Tail: "any",
 				Tail: "any",
 			},
 			},
 			expectedQueryParams: map[string]string{
 			expectedQueryParams: map[string]string{
@@ -52,7 +52,7 @@ func TestServiceLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: true,
 				ShowStderr: true,
 				Timestamps: true,
 				Timestamps: true,
@@ -69,7 +69,7 @@ func TestServiceLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// timestamp will be passed as is
 				// timestamp will be passed as is
 				Since: "1136073600.000000001",
 				Since: "1136073600.000000001",
 			},
 			},
@@ -79,7 +79,7 @@ func TestServiceLogs(t *testing.T) {
 			},
 			},
 		},
 		},
 		{
 		{
-			options: types.ContainerLogsOptions{
+			options: container.LogsOptions{
 				// An complete invalid date will not be passed
 				// An complete invalid date will not be passed
 				Since: "invalid value",
 				Since: "invalid value",
 			},
 			},
@@ -124,7 +124,7 @@ func ExampleClient_ServiceLogs_withTimeout() {
 	defer cancel()
 	defer cancel()
 
 
 	client, _ := NewClientWithOpts(FromEnv)
 	client, _ := NewClientWithOpts(FromEnv)
-	reader, err := client.ServiceLogs(ctx, "service_id", types.ContainerLogsOptions{})
+	reader, err := client.ServiceLogs(ctx, "service_id", container.LogsOptions{})
 	if err != nil {
 	if err != nil {
 		log.Fatal(err)
 		log.Fatal(err)
 	}
 	}

+ 2 - 2
client/service_update.go

@@ -15,7 +15,7 @@ import (
 // ServiceUpdate updates a Service. The version number is required to avoid conflicting writes.
 // ServiceUpdate updates a Service. The version number is required to avoid conflicting writes.
 // It should be the value as set *before* the update. You can find this value in the Meta field
 // It should be the value as set *before* the update. You can find this value in the Meta field
 // of swarm.Service, which can be found using ServiceInspectWithRaw.
 // of swarm.Service, which can be found using ServiceInspectWithRaw.
-func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
+func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
 	// Make sure we negotiated (if the client is configured to do so),
 	// Make sure we negotiated (if the client is configured to do so),
 	// as code below contains API-version specific handling of options.
 	// as code below contains API-version specific handling of options.
 	//
 	//
@@ -25,7 +25,7 @@ func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version
 
 
 	var (
 	var (
 		query    = url.Values{}
 		query    = url.Values{}
-		response = types.ServiceUpdateResponse{}
+		response = swarm.ServiceUpdateResponse{}
 	)
 	)
 
 
 	if options.RegistryAuthFrom != "" {
 	if options.RegistryAuthFrom != "" {

+ 2 - 2
client/task_logs.go

@@ -6,13 +6,13 @@ import (
 	"net/url"
 	"net/url"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
 )
 )
 
 
 // TaskLogs returns the logs generated by a task in an io.ReadCloser.
 // TaskLogs returns the logs generated by a task in an io.ReadCloser.
 // It's up to the caller to close the stream.
 // It's up to the caller to close the stream.
-func (cli *Client) TaskLogs(ctx context.Context, taskID string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
+func (cli *Client) TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error) {
 	query := url.Values{}
 	query := url.Values{}
 	if options.ShowStdout {
 	if options.ShowStdout {
 		query.Set("stdout", "1")
 		query.Set("stdout", "1")

+ 2 - 2
daemon/cluster/executor/backend.go

@@ -41,7 +41,7 @@ type Backend interface {
 	CreateManagedContainer(ctx context.Context, config types.ContainerCreateConfig) (container.CreateResponse, error)
 	CreateManagedContainer(ctx context.Context, config types.ContainerCreateConfig) (container.CreateResponse, error)
 	ContainerStart(ctx context.Context, name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
 	ContainerStart(ctx context.Context, name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error
 	ContainerStop(ctx context.Context, name string, config container.StopOptions) error
 	ContainerStop(ctx context.Context, name string, config container.StopOptions) error
-	ContainerLogs(ctx context.Context, name string, config *types.ContainerLogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
+	ContainerLogs(ctx context.Context, name string, config *container.LogsOptions) (msgs <-chan *backend.LogMessage, tty bool, err error)
 	ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
 	ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error
 	ActivateContainerServiceBinding(containerName string) error
 	ActivateContainerServiceBinding(containerName string) error
 	DeactivateContainerServiceBinding(containerName string) error
 	DeactivateContainerServiceBinding(containerName string) error
@@ -54,7 +54,7 @@ type Backend interface {
 	SetContainerSecretReferences(name string, refs []*swarm.SecretReference) error
 	SetContainerSecretReferences(name string, refs []*swarm.SecretReference) error
 	SetContainerConfigReferences(name string, refs []*swarm.ConfigReference) error
 	SetContainerConfigReferences(name string, refs []*swarm.ConfigReference) error
 	SystemInfo() *system.Info
 	SystemInfo() *system.Info
-	Containers(ctx context.Context, config *types.ContainerListOptions) ([]*types.Container, error)
+	Containers(ctx context.Context, config *container.ListOptions) ([]*types.Container, error)
 	SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
 	SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
 	DaemonJoinsCluster(provider cluster.Provider)
 	DaemonJoinsCluster(provider cluster.Provider)
 	DaemonLeavesCluster()
 	DaemonLeavesCluster()

+ 1 - 1
daemon/cluster/executor/container/adapter.go

@@ -489,7 +489,7 @@ func (c *containerAdapter) deactivateServiceBinding() error {
 }
 }
 
 
 func (c *containerAdapter) logs(ctx context.Context, options api.LogSubscriptionOptions) (<-chan *backend.LogMessage, error) {
 func (c *containerAdapter) logs(ctx context.Context, options api.LogSubscriptionOptions) (<-chan *backend.LogMessage, error) {
-	apiOptions := &types.ContainerLogsOptions{
+	apiOptions := &containertypes.LogsOptions{
 		Follow: options.Follow,
 		Follow: options.Follow,
 
 
 		// Always say yes to Timestamps and Details. we make the decision
 		// Always say yes to Timestamps and Details. we make the decision

+ 8 - 7
daemon/cluster/services.go

@@ -15,6 +15,7 @@ import (
 	"github.com/distribution/reference"
 	"github.com/distribution/reference"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
@@ -180,8 +181,8 @@ func (c *Cluster) GetService(input string, insertDefaults bool) (swarm.Service,
 }
 }
 
 
 // CreateService creates a new service in a managed swarm cluster.
 // CreateService creates a new service in a managed swarm cluster.
-func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRegistry bool) (*types.ServiceCreateResponse, error) {
-	var resp *types.ServiceCreateResponse
+func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRegistry bool) (*swarm.ServiceCreateResponse, error) {
+	var resp *swarm.ServiceCreateResponse
 	err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
 	err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
 		err := c.populateNetworkID(ctx, state.controlClient, &s)
 		err := c.populateNetworkID(ctx, state.controlClient, &s)
 		if err != nil {
 		if err != nil {
@@ -193,7 +194,7 @@ func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRe
 			return errdefs.InvalidParameter(err)
 			return errdefs.InvalidParameter(err)
 		}
 		}
 
 
-		resp = &types.ServiceCreateResponse{}
+		resp = &swarm.ServiceCreateResponse{}
 
 
 		switch serviceSpec.Task.Runtime.(type) {
 		switch serviceSpec.Task.Runtime.(type) {
 		case *swarmapi.TaskSpec_Attachment:
 		case *swarmapi.TaskSpec_Attachment:
@@ -280,8 +281,8 @@ func (c *Cluster) CreateService(s swarm.ServiceSpec, encodedAuth string, queryRe
 }
 }
 
 
 // UpdateService updates existing service to match new properties.
 // UpdateService updates existing service to match new properties.
-func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*types.ServiceUpdateResponse, error) {
-	var resp *types.ServiceUpdateResponse
+func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
+	var resp *swarm.ServiceUpdateResponse
 
 
 	err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
 	err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
 		err := c.populateNetworkID(ctx, state.controlClient, &spec)
 		err := c.populateNetworkID(ctx, state.controlClient, &spec)
@@ -299,7 +300,7 @@ func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swa
 			return err
 			return err
 		}
 		}
 
 
-		resp = &types.ServiceUpdateResponse{}
+		resp = &swarm.ServiceUpdateResponse{}
 
 
 		switch serviceSpec.Task.Runtime.(type) {
 		switch serviceSpec.Task.Runtime.(type) {
 		case *swarmapi.TaskSpec_Attachment:
 		case *swarmapi.TaskSpec_Attachment:
@@ -422,7 +423,7 @@ func (c *Cluster) RemoveService(input string) error {
 }
 }
 
 
 // ServiceLogs collects service logs and writes them back to `config.OutStream`
 // ServiceLogs collects service logs and writes them back to `config.OutStream`
-func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector, config *types.ContainerLogsOptions) (<-chan *backend.LogMessage, error) {
+func (c *Cluster) ServiceLogs(ctx context.Context, selector *backend.LogSelector, config *container.LogsOptions) (<-chan *backend.LogMessage, error) {
 	c.mu.RLock()
 	c.mu.RLock()
 	defer c.mu.RUnlock()
 	defer c.mu.RUnlock()
 
 

+ 2 - 1
daemon/cluster/swarm.go

@@ -9,6 +9,7 @@ import (
 
 
 	"github.com/containerd/log"
 	"github.com/containerd/log"
 	apitypes "github.com/docker/docker/api/types"
 	apitypes "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"
 	types "github.com/docker/docker/api/types/swarm"
 	types "github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/daemon/cluster/convert"
 	"github.com/docker/docker/daemon/cluster/convert"
@@ -606,7 +607,7 @@ func initClusterSpec(node *swarmnode.Node, spec types.Spec) error {
 
 
 func (c *Cluster) listContainerForNode(ctx context.Context, nodeID string) ([]string, error) {
 func (c *Cluster) listContainerForNode(ctx context.Context, nodeID string) ([]string, error) {
 	var ids []string
 	var ids []string
-	containers, err := c.config.Backend.Containers(ctx, &apitypes.ContainerListOptions{
+	containers, err := c.config.Backend.Containers(ctx, &container.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("label", "com.docker.swarm.node.id="+nodeID)),
 		Filters: filters.NewArgs(filters.Arg("label", "com.docker.swarm.node.id="+nodeID)),
 	})
 	})
 	if err != nil {
 	if err != nil {

+ 10 - 10
daemon/containerd/image_delete.go

@@ -9,8 +9,8 @@ import (
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/containerd/images"
 	"github.com/containerd/log"
 	"github.com/containerd/log"
 	"github.com/distribution/reference"
 	"github.com/distribution/reference"
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/events"
+	imagetypes "github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/image"
 	"github.com/docker/docker/image"
 	"github.com/docker/docker/internal/compatcontext"
 	"github.com/docker/docker/internal/compatcontext"
@@ -52,7 +52,7 @@ import (
 // conflict will not be reported.
 // conflict will not be reported.
 //
 //
 // TODO(thaJeztah): image delete should send prometheus counters; see https://github.com/moby/moby/issues/45268
 // TODO(thaJeztah): image delete should send prometheus counters; see https://github.com/moby/moby/issues/45268
-func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
+func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
 	parsedRef, err := reference.ParseNormalizedNamed(imageRef)
 	parsedRef, err := reference.ParseNormalizedNamed(imageRef)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
@@ -80,7 +80,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 			return nil, err
 			return nil, err
 		}
 		}
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
-		records := []types.ImageDeleteResponseItem{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
+		records := []imagetypes.DeleteResponse{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
 		return records, nil
 		return records, nil
 	}
 	}
 
 
@@ -111,7 +111,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 		}
 		}
 
 
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
-		records := []types.ImageDeleteResponseItem{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
+		records := []imagetypes.DeleteResponse{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
 		return records, nil
 		return records, nil
 	}
 	}
 
 
@@ -122,8 +122,8 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 // also deletes dangling parents if there is no conflict in doing so.
 // also deletes dangling parents if there is no conflict in doing so.
 // Parent images are removed quietly, and if there is any issue/conflict
 // Parent images are removed quietly, and if there is any issue/conflict
 // it is logged but does not halt execution/an error is not returned.
 // it is logged but does not halt execution/an error is not returned.
-func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
-	var records []types.ImageDeleteResponseItem
+func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, prune bool) ([]imagetypes.DeleteResponse, error) {
+	var records []imagetypes.DeleteResponse
 
 
 	// Workaround for: https://github.com/moby/buildkit/issues/3797
 	// Workaround for: https://github.com/moby/buildkit/issues/3797
 	possiblyDeletedConfigs := map[digest.Digest]struct{}{}
 	possiblyDeletedConfigs := map[digest.Digest]struct{}{}
@@ -163,7 +163,7 @@ func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, p
 		}
 		}
 	}
 	}
 	i.LogImageEvent(imgID, imgID, events.ActionDelete)
 	i.LogImageEvent(imgID, imgID, events.ActionDelete)
-	records = append(records, types.ImageDeleteResponseItem{Deleted: imgID})
+	records = append(records, imagetypes.DeleteResponse{Deleted: imgID})
 
 
 	for _, parent := range parents {
 	for _, parent := range parents {
 		if !isDanglingImage(parent.img) {
 		if !isDanglingImage(parent.img) {
@@ -176,7 +176,7 @@ func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, p
 		}
 		}
 		parentID := parent.img.Target.Digest.String()
 		parentID := parent.img.Target.Digest.String()
 		i.LogImageEvent(parentID, parentID, events.ActionDelete)
 		i.LogImageEvent(parentID, parentID, events.ActionDelete)
-		records = append(records, types.ImageDeleteResponseItem{Deleted: parentID})
+		records = append(records, imagetypes.DeleteResponse{Deleted: parentID})
 	}
 	}
 
 
 	return records, nil
 	return records, nil
@@ -238,7 +238,7 @@ const (
 // images and untagged references are appended to the given records. If any
 // images and untagged references are appended to the given records. If any
 // error or conflict is encountered, it will be returned immediately without
 // error or conflict is encountered, it will be returned immediately without
 // deleting the image.
 // deleting the image.
-func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image, records *[]types.ImageDeleteResponseItem, force bool) error {
+func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image, records *[]imagetypes.DeleteResponse, force bool) error {
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// if force is true.
 	// if force is true.
 	c := conflictHard
 	c := conflictHard
@@ -264,7 +264,7 @@ func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image,
 
 
 	if !isDanglingImage(img) {
 	if !isDanglingImage(img) {
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
-		*records = append(*records, types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(untaggedRef)})
+		*records = append(*records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(untaggedRef)})
 	}
 	}
 
 
 	return nil
 	return nil

+ 5 - 5
daemon/containerd/image_list.go

@@ -46,7 +46,7 @@ var acceptedImageFilterTags = map[string]bool{
 
 
 // byCreated is a temporary type used to sort a list of images by creation
 // byCreated is a temporary type used to sort a list of images by creation
 // time.
 // time.
-type byCreated []*types.ImageSummary
+type byCreated []*imagetypes.Summary
 
 
 func (r byCreated) Len() int           { return len(r) }
 func (r byCreated) Len() int           { return len(r) }
 func (r byCreated) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
 func (r byCreated) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
@@ -57,7 +57,7 @@ func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
 // TODO(thaJeztah): implement opts.ContainerCount (used for docker system df); see https://github.com/moby/moby/issues/43853
 // TODO(thaJeztah): implement opts.ContainerCount (used for docker system df); see https://github.com/moby/moby/issues/43853
 // TODO(thaJeztah): verify behavior of `RepoDigests` and `RepoTags` for images without (untagged) or multiple tags; see https://github.com/moby/moby/issues/43861
 // TODO(thaJeztah): verify behavior of `RepoDigests` and `RepoTags` for images without (untagged) or multiple tags; see https://github.com/moby/moby/issues/43861
 // TODO(thaJeztah): verify "Size" vs "VirtualSize" in images; see https://github.com/moby/moby/issues/43862
 // TODO(thaJeztah): verify "Size" vs "VirtualSize" in images; see https://github.com/moby/moby/issues/43862
-func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
+func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetypes.Summary, error) {
 	if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
 	if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -89,7 +89,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
 
 
 	var (
 	var (
 		allContainers []*container.Container
 		allContainers []*container.Container
-		summaries     = make([]*types.ImageSummary, 0, len(imgs))
+		summaries     = make([]*imagetypes.Summary, 0, len(imgs))
 		root          []*[]digest.Digest
 		root          []*[]digest.Digest
 		layers        map[digest.Digest]int
 		layers        map[digest.Digest]int
 	)
 	)
@@ -208,7 +208,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
 	return summaries, nil
 	return summaries, nil
 }
 }
 
 
-func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore content.Store, repoTags []string, imageManifest *ImageManifest, opts types.ImageListOptions, allContainers []*container.Container) (*types.ImageSummary, []digest.Digest, error) {
+func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore content.Store, repoTags []string, imageManifest *ImageManifest, opts types.ImageListOptions, allContainers []*container.Container) (*imagetypes.Summary, []digest.Digest, error) {
 	diffIDs, err := imageManifest.RootFS(ctx)
 	diffIDs, err := imageManifest.RootFS(ctx)
 	if err != nil {
 	if err != nil {
 		return nil, nil, errors.Wrapf(err, "failed to get rootfs of image %s", imageManifest.Name())
 		return nil, nil, errors.Wrapf(err, "failed to get rootfs of image %s", imageManifest.Name())
@@ -276,7 +276,7 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
 		return nil, nil, err
 		return nil, nil, err
 	}
 	}
 
 
-	summary := &types.ImageSummary{
+	summary := &imagetypes.Summary{
 		ParentID:    "",
 		ParentID:    "",
 		ID:          target.String(),
 		ID:          target.String(),
 		Created:     rawImg.CreatedAt.Unix(),
 		Created:     rawImg.CreatedAt.Unix(),

+ 3 - 2
daemon/containerd/image_prune.go

@@ -10,6 +10,7 @@ import (
 	"github.com/distribution/reference"
 	"github.com/distribution/reference"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	"github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/internal/compatcontext"
 	"github.com/docker/docker/internal/compatcontext"
 	"github.com/hashicorp/go-multierror"
 	"github.com/hashicorp/go-multierror"
@@ -182,7 +183,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu
 		}
 		}
 
 
 		report.ImagesDeleted = append(report.ImagesDeleted,
 		report.ImagesDeleted = append(report.ImagesDeleted,
-			types.ImageDeleteResponseItem{
+			image.DeleteResponse{
 				Untagged: img.Name,
 				Untagged: img.Name,
 			},
 			},
 		)
 		)
@@ -193,7 +194,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu
 
 
 			if cerrdefs.IsNotFound(err) {
 			if cerrdefs.IsNotFound(err) {
 				report.ImagesDeleted = append(report.ImagesDeleted,
 				report.ImagesDeleted = append(report.ImagesDeleted,
-					types.ImageDeleteResponseItem{
+					image.DeleteResponse{
 						Deleted: blob.Digest.String(),
 						Deleted: blob.Digest.String(),
 					},
 					},
 				)
 				)

+ 3 - 2
daemon/daemon.go

@@ -27,6 +27,7 @@ import (
 	dist "github.com/docker/distribution"
 	dist "github.com/docker/distribution"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
+	imagetypes "github.com/docker/docker/api/types/image"
 	registrytypes "github.com/docker/docker/api/types/registry"
 	registrytypes "github.com/docker/docker/api/types/registry"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/volume"
 	"github.com/docker/docker/api/types/volume"
@@ -122,7 +123,7 @@ type Daemon struct {
 	seccompProfilePath string
 	seccompProfilePath string
 
 
 	usageContainers singleflight.Group[struct{}, []*types.Container]
 	usageContainers singleflight.Group[struct{}, []*types.Container]
-	usageImages     singleflight.Group[struct{}, []*types.ImageSummary]
+	usageImages     singleflight.Group[struct{}, []*imagetypes.Summary]
 	usageVolumes    singleflight.Group[struct{}, []*volume.Volume]
 	usageVolumes    singleflight.Group[struct{}, []*volume.Volume]
 	usageLayer      singleflight.Group[struct{}, int64]
 	usageLayer      singleflight.Group[struct{}, int64]
 
 
@@ -1265,7 +1266,7 @@ func (daemon *Daemon) Shutdown(ctx context.Context) error {
 	cfg := &daemon.config().Config
 	cfg := &daemon.config().Config
 	if cfg.LiveRestoreEnabled && daemon.containers != nil {
 	if cfg.LiveRestoreEnabled && daemon.containers != nil {
 		// check if there are any running containers, if none we should do some cleanup
 		// check if there are any running containers, if none we should do some cleanup
-		if ls, err := daemon.Containers(ctx, &types.ContainerListOptions{}); len(ls) != 0 || err != nil {
+		if ls, err := daemon.Containers(ctx, &containertypes.ListOptions{}); len(ls) != 0 || err != nil {
 			// metrics plugins still need some cleanup
 			// metrics plugins still need some cleanup
 			daemon.cleanupMetricsPlugins()
 			daemon.cleanupMetricsPlugins()
 			return err
 			return err

+ 6 - 4
daemon/disk_usage.go

@@ -6,7 +6,9 @@ import (
 
 
 	"github.com/docker/docker/api/server/router/system"
 	"github.com/docker/docker/api/server/router/system"
 	"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/api/types/image"
 	"github.com/docker/docker/api/types/volume"
 	"github.com/docker/docker/api/types/volume"
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 	"golang.org/x/sync/errgroup"
 	"golang.org/x/sync/errgroup"
@@ -17,7 +19,7 @@ import (
 func (daemon *Daemon) containerDiskUsage(ctx context.Context) ([]*types.Container, error) {
 func (daemon *Daemon) containerDiskUsage(ctx context.Context) ([]*types.Container, error) {
 	res, _, err := daemon.usageContainers.Do(ctx, struct{}{}, func(ctx context.Context) ([]*types.Container, error) {
 	res, _, err := daemon.usageContainers.Do(ctx, struct{}{}, func(ctx context.Context) ([]*types.Container, error) {
 		// Retrieve container list
 		// Retrieve container list
-		containers, err := daemon.Containers(ctx, &types.ContainerListOptions{
+		containers, err := daemon.Containers(ctx, &container.ListOptions{
 			Size: true,
 			Size: true,
 			All:  true,
 			All:  true,
 		})
 		})
@@ -31,8 +33,8 @@ func (daemon *Daemon) containerDiskUsage(ctx context.Context) ([]*types.Containe
 
 
 // imageDiskUsage obtains information about image data disk usage from image service
 // imageDiskUsage obtains information about image data disk usage from image service
 // and makes sure that only one calculation is performed at the same time.
 // and makes sure that only one calculation is performed at the same time.
-func (daemon *Daemon) imageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error) {
-	imgs, _, err := daemon.usageImages.Do(ctx, struct{}{}, func(ctx context.Context) ([]*types.ImageSummary, error) {
+func (daemon *Daemon) imageDiskUsage(ctx context.Context) ([]*image.Summary, error) {
+	imgs, _, err := daemon.usageImages.Do(ctx, struct{}{}, func(ctx context.Context) ([]*image.Summary, error) {
 		// Get all top images with extra attributes
 		// Get all top images with extra attributes
 		imgs, err := daemon.imageService.Images(ctx, types.ImageListOptions{
 		imgs, err := daemon.imageService.Images(ctx, types.ImageListOptions{
 			Filters:        filters.NewArgs(),
 			Filters:        filters.NewArgs(),
@@ -89,7 +91,7 @@ func (daemon *Daemon) SystemDiskUsage(ctx context.Context, opts system.DiskUsage
 	}
 	}
 
 
 	var (
 	var (
-		images     []*types.ImageSummary
+		images     []*image.Summary
 		layersSize int64
 		layersSize int64
 	)
 	)
 	if opts.Images {
 	if opts.Images {

+ 2 - 2
daemon/image_service.go

@@ -30,11 +30,11 @@ type ImageService interface {
 	PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
 	PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
 	PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
 	PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
 	CreateImage(ctx context.Context, config []byte, parent string, contentStoreDigest digest.Digest) (builder.Image, error)
 	CreateImage(ctx context.Context, config []byte, parent string, contentStoreDigest digest.Digest) (builder.Image, error)
-	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
+	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetype.DeleteResponse, error)
 	ExportImage(ctx context.Context, names []string, outStream io.Writer) error
 	ExportImage(ctx context.Context, names []string, outStream io.Writer) error
 	PerformWithBaseFS(ctx context.Context, c *container.Container, fn func(string) error) error
 	PerformWithBaseFS(ctx context.Context, c *container.Container, fn func(string) error) error
 	LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
 	LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
-	Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error)
+	Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetype.Summary, error)
 	LogImageEvent(imageID, refName string, action events.Action)
 	LogImageEvent(imageID, refName string, action events.Action)
 	CountImages() int
 	CountImages() int
 	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
 	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)

+ 10 - 16
daemon/images/image_delete.go

@@ -7,7 +7,6 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/distribution/reference"
 	"github.com/distribution/reference"
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/events"
 	imagetypes "github.com/docker/docker/api/types/image"
 	imagetypes "github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
@@ -61,9 +60,9 @@ const (
 // If prune is true, ancestor images will each attempt to be deleted quietly,
 // If prune is true, ancestor images will each attempt to be deleted quietly,
 // meaning any delete conflicts will cause the image to not be deleted and the
 // meaning any delete conflicts will cause the image to not be deleted and the
 // conflict will not be reported.
 // conflict will not be reported.
-func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
+func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
 	start := time.Now()
 	start := time.Now()
-	records := []types.ImageDeleteResponseItem{}
+	records := []imagetypes.DeleteResponse{}
 
 
 	img, err := i.GetImage(ctx, imageRef, imagetypes.GetImageOpts{})
 	img, err := i.GetImage(ctx, imageRef, imagetypes.GetImageOpts{})
 	if err != nil {
 	if err != nil {
@@ -104,7 +103,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 			return nil, err
 			return nil, err
 		}
 		}
 
 
-		untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(parsedRef)}
+		untaggedRecord := imagetypes.DeleteResponse{Untagged: reference.FamiliarString(parsedRef)}
 
 
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		records = append(records, untaggedRecord)
 		records = append(records, untaggedRecord)
@@ -130,9 +129,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 						if _, err := i.removeImageRef(repoRef); err != nil {
 						if _, err := i.removeImageRef(repoRef); err != nil {
 							return records, err
 							return records, err
 						}
 						}
-
-						untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(repoRef)}
-						records = append(records, untaggedRecord)
+						records = append(records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(repoRef)})
 					} else {
 					} else {
 						remainingRefs = append(remainingRefs, repoRef)
 						remainingRefs = append(remainingRefs, repoRef)
 					}
 					}
@@ -165,11 +162,8 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force,
 				if err != nil {
 				if err != nil {
 					return nil, err
 					return nil, err
 				}
 				}
-
-				untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(parsedRef)}
-
 				i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 				i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
-				records = append(records, untaggedRecord)
+				records = append(records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(parsedRef)})
 			}
 			}
 		}
 		}
 	}
 	}
@@ -243,14 +237,14 @@ func (i *ImageService) removeImageRef(ref reference.Named) (reference.Named, err
 // on the first encountered error. Removed references are logged to this
 // on the first encountered error. Removed references are logged to this
 // daemon's event service. An "Untagged" types.ImageDeleteResponseItem is added to the
 // daemon's event service. An "Untagged" types.ImageDeleteResponseItem is added to the
 // given list of records.
 // given list of records.
-func (i *ImageService) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDeleteResponseItem) error {
+func (i *ImageService) removeAllReferencesToImageID(imgID image.ID, records *[]imagetypes.DeleteResponse) error {
 	for _, imageRef := range i.referenceStore.References(imgID.Digest()) {
 	for _, imageRef := range i.referenceStore.References(imgID.Digest()) {
 		parsedRef, err := i.removeImageRef(imageRef)
 		parsedRef, err := i.removeImageRef(imageRef)
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
 		i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag)
-		*records = append(*records, types.ImageDeleteResponseItem{
+		*records = append(*records, imagetypes.DeleteResponse{
 			Untagged: reference.FamiliarString(parsedRef),
 			Untagged: reference.FamiliarString(parsedRef),
 		})
 		})
 	}
 	}
@@ -291,7 +285,7 @@ func (idc *imageDeleteConflict) Conflict() {}
 // conflict is encountered, it will be returned immediately without deleting
 // conflict is encountered, it will be returned immediately without deleting
 // the image. If quiet is true, any encountered conflicts will be ignored and
 // the image. If quiet is true, any encountered conflicts will be ignored and
 // the function will return nil immediately without deleting the image.
 // the function will return nil immediately without deleting the image.
-func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]types.ImageDeleteResponseItem, force, prune, quiet bool) error {
+func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]imagetypes.DeleteResponse, force, prune, quiet bool) error {
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// First, determine if this image has any conflicts. Ignore soft conflicts
 	// if force is true.
 	// if force is true.
 	c := conflictHard
 	c := conflictHard
@@ -327,9 +321,9 @@ func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]types.ImageD
 	}
 	}
 
 
 	i.LogImageEvent(imgID.String(), imgID.String(), events.ActionDelete)
 	i.LogImageEvent(imgID.String(), imgID.String(), events.ActionDelete)
-	*records = append(*records, types.ImageDeleteResponseItem{Deleted: imgID.String()})
+	*records = append(*records, imagetypes.DeleteResponse{Deleted: imgID.String()})
 	for _, removedLayer := range removedLayers {
 	for _, removedLayer := range removedLayers {
-		*records = append(*records, types.ImageDeleteResponseItem{Deleted: removedLayer.ChainID.String()})
+		*records = append(*records, imagetypes.DeleteResponse{Deleted: removedLayer.ChainID.String()})
 	}
 	}
 
 
 	if !prune || parent == "" {
 	if !prune || parent == "" {

+ 7 - 7
daemon/images/image_list.go

@@ -25,14 +25,14 @@ var acceptedImageFilterTags = map[string]bool{
 
 
 // byCreated is a temporary type used to sort a list of images by creation
 // byCreated is a temporary type used to sort a list of images by creation
 // time.
 // time.
-type byCreated []*types.ImageSummary
+type byCreated []*imagetypes.Summary
 
 
 func (r byCreated) Len() int           { return len(r) }
 func (r byCreated) Len() int           { return len(r) }
 func (r byCreated) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
 func (r byCreated) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
 func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
 func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
 
 
 // Images returns a filtered list of images.
 // Images returns a filtered list of images.
-func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
+func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetypes.Summary, error) {
 	if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
 	if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -83,8 +83,8 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
 	}
 	}
 
 
 	var (
 	var (
-		summaries     = make([]*types.ImageSummary, 0, len(selectedImages))
-		summaryMap    map[*image.Image]*types.ImageSummary
+		summaries     = make([]*imagetypes.Summary, 0, len(selectedImages))
+		summaryMap    map[*image.Image]*imagetypes.Summary
 		allContainers []*container.Container
 		allContainers []*container.Container
 	)
 	)
 	for id, img := range selectedImages {
 	for id, img := range selectedImages {
@@ -197,7 +197,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
 		if opts.ContainerCount || opts.SharedSize {
 		if opts.ContainerCount || opts.SharedSize {
 			// Lazily init summaryMap.
 			// Lazily init summaryMap.
 			if summaryMap == nil {
 			if summaryMap == nil {
-				summaryMap = make(map[*image.Image]*types.ImageSummary, len(selectedImages))
+				summaryMap = make(map[*image.Image]*imagetypes.Summary, len(selectedImages))
 			}
 			}
 			summaryMap[img] = summary
 			summaryMap[img] = summary
 		}
 		}
@@ -252,12 +252,12 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
 	return summaries, nil
 	return summaries, nil
 }
 }
 
 
-func newImageSummary(image *image.Image, size int64) *types.ImageSummary {
+func newImageSummary(image *image.Image, size int64) *imagetypes.Summary {
 	var created int64
 	var created int64
 	if image.Created != nil {
 	if image.Created != nil {
 		created = image.Created.Unix()
 		created = image.Created.Unix()
 	}
 	}
-	summary := &types.ImageSummary{
+	summary := &imagetypes.Summary{
 		ParentID: image.Parent.String(),
 		ParentID: image.Parent.String(),
 		ID:       image.ID().String(),
 		ID:       image.ID().String(),
 		Created:  created,
 		Created:  created,

+ 2 - 1
daemon/images/image_prune.go

@@ -12,6 +12,7 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
+	imagetypes "github.com/docker/docker/api/types/image"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/image"
 	"github.com/docker/docker/image"
@@ -96,7 +97,7 @@ deleteImagesLoop:
 		default:
 		default:
 		}
 		}
 
 
-		deletedImages := []types.ImageDeleteResponseItem{}
+		deletedImages := []imagetypes.DeleteResponse{}
 		refs := i.referenceStore.References(id.Digest())
 		refs := i.referenceStore.References(id.Digest())
 		if len(refs) > 0 {
 		if len(refs) > 0 {
 			shouldDelete := !danglingOnly
 			shouldDelete := !danglingOnly

+ 18 - 17
daemon/list.go

@@ -9,6 +9,7 @@ import (
 
 
 	"github.com/containerd/log"
 	"github.com/containerd/log"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/filters"
 	imagetypes "github.com/docker/docker/api/types/image"
 	imagetypes "github.com/docker/docker/api/types/image"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
@@ -54,7 +55,7 @@ func (daemon *Daemon) List() []*container.Container {
 }
 }
 
 
 // listContext is the daemon generated filtering to iterate over containers.
 // listContext is the daemon generated filtering to iterate over containers.
-// This is created based on the user specification from types.ContainerListOptions.
+// This is created based on the user specification from [containertypes.ListOptions].
 type listContext struct {
 type listContext struct {
 	// idx is the container iteration index for this context
 	// idx is the container iteration index for this context
 	idx int
 	idx int
@@ -84,8 +85,8 @@ type listContext struct {
 	// expose is a list of exposed ports to filter with
 	// expose is a list of exposed ports to filter with
 	expose map[nat.Port]bool
 	expose map[nat.Port]bool
 
 
-	// ContainerListOptions is the filters set by the user
-	*types.ContainerListOptions
+	// ListOptions is the filters set by the user
+	*containertypes.ListOptions
 }
 }
 
 
 // byCreatedDescending is a temporary type used to sort a list of containers by creation time.
 // byCreatedDescending is a temporary type used to sort a list of containers by creation time.
@@ -98,7 +99,7 @@ func (r byCreatedDescending) Less(i, j int) bool {
 }
 }
 
 
 // Containers returns the list of containers to show given the user's filtering.
 // Containers returns the list of containers to show given the user's filtering.
-func (daemon *Daemon) Containers(ctx context.Context, config *types.ContainerListOptions) ([]*types.Container, error) {
+func (daemon *Daemon) Containers(ctx context.Context, config *containertypes.ListOptions) ([]*types.Container, error) {
 	if err := config.Filters.Validate(acceptedPsFilterTags); err != nil {
 	if err := config.Filters.Validate(acceptedPsFilterTags); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -224,7 +225,7 @@ func (daemon *Daemon) filterByNameIDMatches(view *container.View, filter *listCo
 }
 }
 
 
 // foldFilter generates the container filter based on the user's filtering options.
 // foldFilter generates the container filter based on the user's filtering options.
-func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, config *types.ContainerListOptions) (*listContext, error) {
+func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, config *containertypes.ListOptions) (*listContext, error) {
 	psFilters := config.Filters
 	psFilters := config.Filters
 
 
 	var filtExited []int
 	var filtExited []int
@@ -323,18 +324,18 @@ func (daemon *Daemon) foldFilter(ctx context.Context, view *container.View, conf
 	}
 	}
 
 
 	return &listContext{
 	return &listContext{
-		filters:              psFilters,
-		ancestorFilter:       ancestorFilter,
-		images:               imagesFilter,
-		exitAllowed:          filtExited,
-		beforeFilter:         beforeContFilter,
-		sinceFilter:          sinceContFilter,
-		taskFilter:           taskFilter,
-		isTask:               isTask,
-		publish:              publishFilter,
-		expose:               exposeFilter,
-		ContainerListOptions: config,
-		names:                view.GetAllNames(),
+		filters:        psFilters,
+		ancestorFilter: ancestorFilter,
+		images:         imagesFilter,
+		exitAllowed:    filtExited,
+		beforeFilter:   beforeContFilter,
+		sinceFilter:    sinceContFilter,
+		taskFilter:     taskFilter,
+		isTask:         isTask,
+		publish:        publishFilter,
+		expose:         exposeFilter,
+		ListOptions:    config,
+		names:          view.GetAllNames(),
 	}, nil
 	}, nil
 }
 }
 
 

+ 5 - 5
daemon/list_test.go

@@ -87,7 +87,7 @@ func TestListInvalidFilter(t *testing.T) {
 		containersReplica: db,
 		containersReplica: db,
 	}
 	}
 
 
-	_, err = d.Containers(context.Background(), &types.ContainerListOptions{
+	_, err = d.Containers(context.Background(), &containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("invalid", "foo")),
 		Filters: filters.NewArgs(filters.Arg("invalid", "foo")),
 	})
 	})
 	assert.Assert(t, is.Error(err, "invalid filter 'invalid'"))
 	assert.Assert(t, is.Error(err, "invalid filter 'invalid'"))
@@ -108,7 +108,7 @@ func TestNameFilter(t *testing.T) {
 
 
 	// moby/moby #37453 - ^ regex not working due to prefix slash
 	// moby/moby #37453 - ^ regex not working due to prefix slash
 	// not being stripped
 	// not being stripped
-	containerList, err := d.Containers(context.Background(), &types.ContainerListOptions{
+	containerList, err := d.Containers(context.Background(), &containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("name", "^a")),
 		Filters: filters.NewArgs(filters.Arg("name", "^a")),
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -117,7 +117,7 @@ func TestNameFilter(t *testing.T) {
 	assert.Assert(t, containerListContainsName(containerList, two.Name))
 	assert.Assert(t, containerListContainsName(containerList, two.Name))
 
 
 	// Same as above but with slash prefix should produce the same result
 	// Same as above but with slash prefix should produce the same result
-	containerListWithPrefix, err := d.Containers(context.Background(), &types.ContainerListOptions{
+	containerListWithPrefix, err := d.Containers(context.Background(), &containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("name", "^/a")),
 		Filters: filters.NewArgs(filters.Arg("name", "^/a")),
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -126,7 +126,7 @@ func TestNameFilter(t *testing.T) {
 	assert.Assert(t, containerListContainsName(containerListWithPrefix, two.Name))
 	assert.Assert(t, containerListContainsName(containerListWithPrefix, two.Name))
 
 
 	// Same as above but make sure it works for exact names
 	// Same as above but make sure it works for exact names
-	containerList, err = d.Containers(context.Background(), &types.ContainerListOptions{
+	containerList, err = d.Containers(context.Background(), &containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("name", "b1")),
 		Filters: filters.NewArgs(filters.Arg("name", "b1")),
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -134,7 +134,7 @@ func TestNameFilter(t *testing.T) {
 	assert.Assert(t, containerListContainsName(containerList, three.Name))
 	assert.Assert(t, containerListContainsName(containerList, three.Name))
 
 
 	// Same as above but with slash prefix should produce the same result
 	// Same as above but with slash prefix should produce the same result
-	containerListWithPrefix, err = d.Containers(context.Background(), &types.ContainerListOptions{
+	containerListWithPrefix, err = d.Containers(context.Background(), &containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("name", "/b1")),
 		Filters: filters.NewArgs(filters.Arg("name", "/b1")),
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 1 - 2
daemon/logs.go

@@ -6,7 +6,6 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/containerd/log"
 	"github.com/containerd/log"
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	timetypes "github.com/docker/docker/api/types/time"
 	timetypes "github.com/docker/docker/api/types/time"
@@ -24,7 +23,7 @@ import (
 //
 //
 // if it returns nil, the config channel will be active and return log
 // if it returns nil, the config channel will be active and return log
 // messages until it runs out or the context is canceled.
 // messages until it runs out or the context is canceled.
-func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *types.ContainerLogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error) {
+func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *containertypes.LogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error) {
 	lg := log.G(ctx).WithFields(log.Fields{
 	lg := log.G(ctx).WithFields(log.Fields{
 		"module":    "daemon",
 		"module":    "daemon",
 		"method":    "(*Daemon).ContainerLogs",
 		"method":    "(*Daemon).ContainerLogs",

+ 11 - 4
hack/generate-swagger-api.sh

@@ -6,15 +6,12 @@ swagger generate model -f api/swagger.yaml \
 	-n ErrorResponse \
 	-n ErrorResponse \
 	-n GraphDriverData \
 	-n GraphDriverData \
 	-n IdResponse \
 	-n IdResponse \
-	-n ImageDeleteResponseItem \
-	-n ImageSummary \
 	-n Plugin \
 	-n Plugin \
 	-n PluginDevice \
 	-n PluginDevice \
 	-n PluginMount \
 	-n PluginMount \
 	-n PluginEnv \
 	-n PluginEnv \
 	-n PluginInterfaceType \
 	-n PluginInterfaceType \
-	-n Port \
-	-n ServiceUpdateResponse
+	-n Port
 
 
 swagger generate model -f api/swagger.yaml \
 swagger generate model -f api/swagger.yaml \
 	-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
 	-t api -m types/container --skip-validator -C api/swagger-gen.yaml \
@@ -24,6 +21,11 @@ swagger generate model -f api/swagger.yaml \
 	-n ChangeType \
 	-n ChangeType \
 	-n FilesystemChange
 	-n FilesystemChange
 
 
+swagger generate model -f api/swagger.yaml \
+	-t api -m types/image --skip-validator -C api/swagger-gen.yaml \
+	-n ImageDeleteResponseItem \
+	-n ImageSummary
+
 swagger generate model -f api/swagger.yaml \
 swagger generate model -f api/swagger.yaml \
 	-t api -m types/volume --skip-validator -C api/swagger-gen.yaml \
 	-t api -m types/volume --skip-validator -C api/swagger-gen.yaml \
 	-n Volume \
 	-n Volume \
@@ -37,3 +39,8 @@ swagger generate operation -f api/swagger.yaml \
 	-n ContainerTop \
 	-n ContainerTop \
 	-n ContainerUpdate \
 	-n ContainerUpdate \
 	-n ImageHistory
 	-n ImageHistory
+
+swagger generate model -f api/swagger.yaml \
+	-t api -m types/swarm --skip-validator -C api/swagger-gen.yaml \
+	-n ServiceCreateResponse \
+	-n ServiceUpdateResponse

+ 2 - 1
integration-cli/docker_api_attach_test.go

@@ -11,6 +11,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -184,7 +185,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
 	cid = strings.TrimSpace(cid)
 	cid = strings.TrimSpace(cid)
 
 
 	// Make sure we don't see "hello" if Logs is false
 	// Make sure we don't see "hello" if Logs is false
-	attachOpts := types.ContainerAttachOptions{
+	attachOpts := container.AttachOptions{
 		Stream: true,
 		Stream: true,
 		Stdin:  true,
 		Stdin:  true,
 		Stdout: true,
 		Stdout: true,

+ 15 - 15
integration-cli/docker_api_containers_test.go

@@ -45,7 +45,7 @@ func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	options := types.ContainerListOptions{
+	options := container.ListOptions{
 		All: true,
 		All: true,
 	}
 	}
 	ctx := testutil.GetContext(c)
 	ctx := testutil.GetContext(c)
@@ -65,7 +65,7 @@ func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	options := types.ContainerListOptions{
+	options := container.ListOptions{
 		All: true,
 		All: true,
 	}
 	}
 	ctx := testutil.GetContext(c)
 	ctx := testutil.GetContext(c)
@@ -454,7 +454,7 @@ func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	options := types.ContainerCommitOptions{
+	options := container.CommitOptions{
 		Reference: "testcontainerapicommit:testtag",
 		Reference: "testcontainerapicommit:testtag",
 	}
 	}
 
 
@@ -480,7 +480,7 @@ func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
 		Labels: map[string]string{"key1": "value1", "key2": "value2"},
 		Labels: map[string]string{"key1": "value1", "key2": "value2"},
 	}
 	}
 
 
-	options := types.ContainerCommitOptions{
+	options := container.CommitOptions{
 		Reference: "testcontainerapicommitwithconfig",
 		Reference: "testcontainerapicommitwithconfig",
 		Config:    &config,
 		Config:    &config,
 	}
 	}
@@ -924,12 +924,12 @@ func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
 	_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
 	_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
 	assert.NilError(c, err)
 	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.NilError(c, err)
 
 
 	// second call to start should give 304
 	// second call to start should give 304
 	// maybe add ContainerStartWithRaw to test it
 	// 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)
 	assert.NilError(c, err)
 
 
 	// TODO(tibor): figure out why this doesn't work on windows
 	// TODO(tibor): figure out why this doesn't work on windows
@@ -1089,7 +1089,7 @@ func (s *DockerAPISuite) TestContainerAPIDelete(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	err = apiClient.ContainerRemove(testutil.GetContext(c), id, types.ContainerRemoveOptions{})
+	err = apiClient.ContainerRemove(testutil.GetContext(c), id, container.RemoveOptions{})
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 }
 }
 
 
@@ -1098,7 +1098,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteNotExist(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	err = apiClient.ContainerRemove(testutil.GetContext(c), "doesnotexist", types.ContainerRemoveOptions{})
+	err = apiClient.ContainerRemove(testutil.GetContext(c), "doesnotexist", container.RemoveOptions{})
 	assert.ErrorContains(c, err, "No such container: doesnotexist")
 	assert.ErrorContains(c, err, "No such container: doesnotexist")
 }
 }
 
 
@@ -1107,7 +1107,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
 	id := strings.TrimSpace(out)
 	id := strings.TrimSpace(out)
 	assert.NilError(c, waitRun(id))
 	assert.NilError(c, waitRun(id))
 
 
-	removeOptions := types.ContainerRemoveOptions{
+	removeOptions := container.RemoveOptions{
 		Force: true,
 		Force: true,
 	}
 	}
 
 
@@ -1135,7 +1135,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
 	links := inspectFieldJSON(c, id2, "HostConfig.Links")
 	links := inspectFieldJSON(c, id2, "HostConfig.Links")
 	assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
 	assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
 
 
-	removeOptions := types.ContainerRemoveOptions{
+	removeOptions := container.RemoveOptions{
 		RemoveLinks: true,
 		RemoveLinks: true,
 	}
 	}
 
 
@@ -1168,7 +1168,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
 	_, err = os.Stat(source)
 	_, err = os.Stat(source)
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 
 
-	removeOptions := types.ContainerRemoveOptions{
+	removeOptions := container.RemoveOptions{
 		Force:         true,
 		Force:         true,
 		RemoveVolumes: true,
 		RemoveVolumes: true,
 	}
 	}
@@ -1549,7 +1549,7 @@ func (s *DockerAPISuite) TestContainerAPIDeleteWithEmptyName(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	err = apiClient.ContainerRemove(testutil.GetContext(c), "", types.ContainerRemoveOptions{})
+	err = apiClient.ContainerRemove(testutil.GetContext(c), "", container.RemoveOptions{})
 	assert.Check(c, errdefs.IsNotFound(err))
 	assert.Check(c, errdefs.IsNotFound(err))
 }
 }
 
 
@@ -1572,7 +1572,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
 	_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
 	_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, name)
 	assert.NilError(c, err)
 	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.NilError(c, err)
 
 
 	assert.Assert(c, waitRun(name) == nil)
 	assert.Assert(c, waitRun(name) == nil)
@@ -2112,11 +2112,11 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsCreate(c *testing.T) {
 			assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode))
 			assert.Check(c, is.Equal(x.expected.Mode, mountPoint.Mode))
 			assert.Check(c, is.Equal(x.expected.Destination, mountPoint.Destination))
 			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)
 			assert.NilError(c, err)
 			poll.WaitOn(c, containerExit(ctx, apiclient, ctr.ID), poll.WithDelay(time.Second))
 			poll.WaitOn(c, containerExit(ctx, apiclient, ctr.ID), poll.WithDelay(time.Second))
 
 
-			err = apiclient.ContainerRemove(ctx, ctr.ID, types.ContainerRemoveOptions{
+			err = apiclient.ContainerRemove(ctx, ctr.ID, container.RemoveOptions{
 				RemoveVolumes: true,
 				RemoveVolumes: true,
 				Force:         true,
 				Force:         true,
 			})
 			})

+ 1 - 2
integration-cli/docker_api_containers_windows_test.go

@@ -10,7 +10,6 @@ import (
 	"testing"
 	"testing"
 
 
 	winio "github.com/Microsoft/go-winio"
 	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/container"
 	"github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -66,7 +65,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsBindNamedPipe(c *testing.T
 		nil, nil, name)
 		nil, nil, name)
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 
 
-	err = client.ContainerStart(ctx, name, types.ContainerStartOptions{})
+	err = client.ContainerStart(ctx, name, container.StartOptions{})
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 
 
 	err = <-ch
 	err = <-ch

+ 14 - 10
integration-cli/docker_api_logs_test.go

@@ -11,7 +11,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -62,7 +62,7 @@ func (s *DockerAPISuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	_, err = apiClient.ContainerLogs(testutil.GetContext(c), name, types.ContainerLogsOptions{})
+	_, err = apiClient.ContainerLogs(testutil.GetContext(c), name, container.LogsOptions{})
 	assert.ErrorContains(c, err, "Bad parameters: you must choose at least one stream")
 	assert.ErrorContains(c, err, "Bad parameters: you must choose at least one stream")
 }
 }
 
 
@@ -105,8 +105,12 @@ func (s *DockerAPISuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 
 
-	cfg := types.ContainerLogsOptions{Until: until.Format(time.RFC3339Nano), Follow: true, ShowStdout: true, Timestamps: true}
-	reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
+	reader, err := client.ContainerLogs(testutil.GetContext(c), name, container.LogsOptions{
+		Until:      until.Format(time.RFC3339Nano),
+		Follow:     true,
+		ShowStdout: true,
+		Timestamps: true,
+	})
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 
 
 	type logOut struct {
 	type logOut struct {
@@ -167,7 +171,7 @@ func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 
 
-	extractBody := func(c *testing.T, cfg types.ContainerLogsOptions) []string {
+	extractBody := func(c *testing.T, cfg container.LogsOptions) []string {
 		reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
 		reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
 		assert.NilError(c, err)
 		assert.NilError(c, err)
 
 
@@ -180,7 +184,7 @@ func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
 	}
 	}
 
 
 	// Get timestamp of second log line
 	// Get timestamp of second log line
-	allLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true})
+	allLogs := extractBody(c, container.LogsOptions{Timestamps: true, ShowStdout: true})
 	assert.Assert(c, len(allLogs) >= 3)
 	assert.Assert(c, len(allLogs) >= 3)
 
 
 	t, err := time.Parse(time.RFC3339Nano, strings.Split(allLogs[1], " ")[0])
 	t, err := time.Parse(time.RFC3339Nano, strings.Split(allLogs[1], " ")[0])
@@ -188,7 +192,7 @@ func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
 	until := t.Format(time.RFC3339Nano)
 	until := t.Format(time.RFC3339Nano)
 
 
 	// Get logs until the timestamp of second line, i.e. first two lines
 	// Get logs until the timestamp of second line, i.e. first two lines
-	logs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true, Until: until})
+	logs := extractBody(c, container.LogsOptions{Timestamps: true, ShowStdout: true, Until: until})
 
 
 	// Ensure log lines after cut-off are excluded
 	// Ensure log lines after cut-off are excluded
 	logsString := strings.Join(logs, "\n")
 	logsString := strings.Join(logs, "\n")
@@ -204,7 +208,7 @@ func (s *DockerAPISuite) TestLogsAPIUntilDefaultValue(c *testing.T) {
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 
 
-	extractBody := func(c *testing.T, cfg types.ContainerLogsOptions) []string {
+	extractBody := func(c *testing.T, cfg container.LogsOptions) []string {
 		reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
 		reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
 		assert.NilError(c, err)
 		assert.NilError(c, err)
 
 
@@ -217,9 +221,9 @@ func (s *DockerAPISuite) TestLogsAPIUntilDefaultValue(c *testing.T) {
 	}
 	}
 
 
 	// Get timestamp of second log line
 	// Get timestamp of second log line
-	allLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true})
+	allLogs := extractBody(c, container.LogsOptions{Timestamps: true, ShowStdout: true})
 
 
 	// Test with default value specified and parameter omitted
 	// Test with default value specified and parameter omitted
-	defaultLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true, Until: "0"})
+	defaultLogs := extractBody(c, container.LogsOptions{Timestamps: true, ShowStdout: true, Until: "0"})
 	assert.DeepEqual(c, defaultLogs, allLogs)
 	assert.DeepEqual(c, defaultLogs, allLogs)
 }
 }

+ 2 - 2
integration-cli/docker_cli_events_test.go

@@ -13,7 +13,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	"github.com/docker/docker/api/types/container"
 	eventtypes "github.com/docker/docker/api/types/events"
 	eventtypes "github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	eventstestutils "github.com/docker/docker/daemon/events/testutils"
 	eventstestutils "github.com/docker/docker/daemon/events/testutils"
@@ -459,7 +459,7 @@ func (s *DockerCLIEventSuite) TestEventsResize(c *testing.T) {
 	assert.NilError(c, err)
 	assert.NilError(c, err)
 	defer apiClient.Close()
 	defer apiClient.Close()
 
 
-	options := types.ResizeOptions{
+	options := container.ResizeOptions{
 		Height: 80,
 		Height: 80,
 		Width:  24,
 		Width:  24,
 	}
 	}

+ 2 - 1
integration/build/build_squash_test.go

@@ -7,6 +7,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	dclient "github.com/docker/docker/client"
 	dclient "github.com/docker/docker/client"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
@@ -84,7 +85,7 @@ func TestBuildSquashParent(t *testing.T) {
 		container.WithImage(name),
 		container.WithImage(name),
 		container.WithCmd("/bin/sh", "-c", "cat /hello"),
 		container.WithCmd("/bin/sh", "-c", "cat /hello"),
 	)
 	)
-	reader, err := client.ContainerLogs(ctx, cid, types.ContainerLogsOptions{
+	reader, err := client.ContainerLogs(ctx, cid, containertypes.LogsOptions{
 		ShowStdout: true,
 		ShowStdout: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 2 - 1
integration/build/build_test.go

@@ -10,6 +10,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"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/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
@@ -109,7 +110,7 @@ func TestBuildWithRemoveAndForceRemove(t *testing.T) {
 			defer resp.Body.Close()
 			defer resp.Body.Close()
 			filter, err := buildContainerIdsFilter(resp.Body)
 			filter, err := buildContainerIdsFilter(resp.Body)
 			assert.NilError(t, err)
 			assert.NilError(t, err)
-			remainingContainers, err := client.ContainerList(ctx, types.ContainerListOptions{Filters: filter, All: true})
+			remainingContainers, err := client.ContainerList(ctx, container.ListOptions{Filters: filter, All: true})
 			assert.NilError(t, err)
 			assert.NilError(t, err)
 			assert.Equal(t, c.numberOfIntermediateContainers, len(remainingContainers), "Expected %v remaining intermediate containers, got %v", c.numberOfIntermediateContainers, len(remainingContainers))
 			assert.Equal(t, c.numberOfIntermediateContainers, len(remainingContainers), "Expected %v remaining intermediate containers, got %v", c.numberOfIntermediateContainers, len(remainingContainers))
 		})
 		})

+ 2 - 1
integration/build/build_userns_linux_test.go

@@ -9,6 +9,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"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/integration/internal/container"
 	"github.com/docker/docker/pkg/jsonmessage"
 	"github.com/docker/docker/pkg/jsonmessage"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
@@ -116,7 +117,7 @@ func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
 		container.WithImage(imageTag),
 		container.WithImage(imageTag),
 		container.WithCmd("/sbin/getcap", "-n", "/bin/sleep"),
 		container.WithCmd("/sbin/getcap", "-n", "/bin/sleep"),
 	)
 	)
-	logReader, err := clientNoUserRemap.ContainerLogs(ctx, cid, types.ContainerLogsOptions{
+	logReader, err := clientNoUserRemap.ContainerLogs(ctx, cid, containertypes.LogsOptions{
 		ShowStdout: true,
 		ShowStdout: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 2 - 1
integration/capabilities/capabilities_linux_test.go

@@ -8,6 +8,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"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/integration/internal/container"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -83,7 +84,7 @@ func TestNoNewPrivileges(t *testing.T) {
 			poll.WaitOn(t, container.IsInState(ctx, client, cid, "exited"), poll.WithDelay(100*time.Millisecond))
 			poll.WaitOn(t, container.IsInState(ctx, client, cid, "exited"), poll.WithDelay(100*time.Millisecond))
 
 
 			// Assert on outputs
 			// Assert on outputs
-			logReader, err := client.ContainerLogs(ctx, cid, types.ContainerLogsOptions{
+			logReader, err := client.ContainerLogs(ctx, cid, containertypes.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: true,
 				ShowStderr: true,
 			})
 			})

+ 3 - 3
integration/container/attach_test.go

@@ -13,7 +13,7 @@ import (
 
 
 func TestAttach(t *testing.T) {
 func TestAttach(t *testing.T) {
 	ctx := setupTest(t)
 	ctx := setupTest(t)
-	client := testEnv.APIClient()
+	apiClient := testEnv.APIClient()
 
 
 	tests := []struct {
 	tests := []struct {
 		doc               string
 		doc               string
@@ -36,7 +36,7 @@ func TestAttach(t *testing.T) {
 			t.Parallel()
 			t.Parallel()
 
 
 			ctx := testutil.StartSpan(ctx, t)
 			ctx := testutil.StartSpan(ctx, t)
-			resp, err := client.ContainerCreate(ctx,
+			resp, err := apiClient.ContainerCreate(ctx,
 				&container.Config{
 				&container.Config{
 					Image: "busybox",
 					Image: "busybox",
 					Cmd:   []string{"echo", "hello"},
 					Cmd:   []string{"echo", "hello"},
@@ -48,7 +48,7 @@ func TestAttach(t *testing.T) {
 				"",
 				"",
 			)
 			)
 			assert.NilError(t, err)
 			assert.NilError(t, err)
-			attach, err := client.ContainerAttach(ctx, resp.ID, types.ContainerAttachOptions{
+			attach, err := apiClient.ContainerAttach(ctx, resp.ID, container.AttachOptions{
 				Stdout: true,
 				Stdout: true,
 				Stderr: true,
 				Stderr: true,
 			})
 			})

+ 2 - 3
integration/container/cdi_test.go

@@ -9,7 +9,6 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/docker/docker/pkg/stdcopy"
@@ -38,7 +37,7 @@ func TestCreateWithCDIDevices(t *testing.T) {
 		container.WithCmd("/bin/sh", "-c", "env"),
 		container.WithCmd("/bin/sh", "-c", "env"),
 		container.WithCDIDevices("vendor1.com/device=foo"),
 		container.WithCDIDevices("vendor1.com/device=foo"),
 	)
 	)
-	defer apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
+	defer apiClient.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true})
 
 
 	inspect, err := apiClient.ContainerInspect(ctx, id)
 	inspect, err := apiClient.ContainerInspect(ctx, id)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -51,7 +50,7 @@ func TestCreateWithCDIDevices(t *testing.T) {
 	}
 	}
 	assert.Check(t, is.DeepEqual(inspect.HostConfig.DeviceRequests, expectedRequests))
 	assert.Check(t, is.DeepEqual(inspect.HostConfig.DeviceRequests, expectedRequests))
 
 
-	reader, err := apiClient.ContainerLogs(ctx, id, types.ContainerLogsOptions{
+	reader, err := apiClient.ContainerLogs(ctx, id, containertypes.LogsOptions{
 		ShowStdout: true,
 		ShowStdout: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 2 - 2
integration/container/checkpoint_test.go

@@ -8,8 +8,8 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/checkpoint"
 	"github.com/docker/docker/api/types/checkpoint"
+	containertypes "github.com/docker/docker/api/types/container"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -128,7 +128,7 @@ func TestCheckpoint(t *testing.T) {
 
 
 	// Restore the container from a second checkpoint.
 	// Restore the container from a second checkpoint.
 	t.Log("Restore the container")
 	t.Log("Restore the container")
-	err = apiClient.ContainerStart(ctx, cID, types.ContainerStartOptions{
+	err = apiClient.ContainerStart(ctx, cID, containertypes.StartOptions{
 		CheckpointID: "test2",
 		CheckpointID: "test2",
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 12 - 14
integration/container/create_test.go

@@ -8,9 +8,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/container"
 	"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/network"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
@@ -253,7 +251,7 @@ func TestCreateWithCustomMaskedPaths(t *testing.T) {
 		checkInspect(t, ctx, name, tc.expected)
 		checkInspect(t, ctx, name, tc.expected)
 
 
 		// Start the container.
 		// Start the container.
-		err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
+		err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
 		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)
 		checkInspect(t, ctx, name, tc.expected)
 
 
 		// Start the container.
 		// Start the container.
-		err = apiClient.ContainerStart(ctx, c.ID, types.ContainerStartOptions{})
+		err = apiClient.ContainerStart(ctx, c.ID, container.StartOptions{})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		poll.WaitOn(t, ctr.IsInState(ctx, apiClient, c.ID, "exited"), poll.WithDelay(100*time.Millisecond))
 		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() {
 	defer func() {
-		err := apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
+		err := apiClient.ContainerRemove(ctx, id, container.RemoveOptions{Force: true})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 	}()
 	}()
 
 
@@ -447,7 +445,7 @@ func TestCreateTmpfsOverrideAnonymousVolume(t *testing.T) {
 	assert.Assert(t, is.Len(inspect.Mounts, 0))
 	assert.Assert(t, is.Len(inspect.Mounts, 0))
 
 
 	chWait, chErr := apiClient.ContainerWait(ctx, id, container.WaitConditionNextExit)
 	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)
 	timeout := time.NewTimer(30 * time.Second)
 	defer timeout.Stop()
 	defer timeout.Stop()
@@ -483,7 +481,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
 			Architecture: img.Architecture,
 			Architecture: img.Architecture,
 			Variant:      img.Variant,
 			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))
 		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	})
 	})
 	t.Run("different cpu arch", func(t *testing.T) {
 	t.Run("different cpu arch", func(t *testing.T) {
@@ -493,7 +491,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
 			Architecture: img.Architecture + "DifferentArch",
 			Architecture: img.Architecture + "DifferentArch",
 			Variant:      img.Variant,
 			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))
 		assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	})
 	})
 }
 }
@@ -541,32 +539,32 @@ func TestCreateInvalidHostConfig(t *testing.T) {
 
 
 	testCases := []struct {
 	testCases := []struct {
 		doc         string
 		doc         string
-		hc          containertypes.HostConfig
+		hc          container.HostConfig
 		expectedErr string
 		expectedErr string
 	}{
 	}{
 		{
 		{
 			doc:         "invalid IpcMode",
 			doc:         "invalid IpcMode",
-			hc:          containertypes.HostConfig{IpcMode: "invalid"},
+			hc:          container.HostConfig{IpcMode: "invalid"},
 			expectedErr: "Error response from daemon: invalid IPC mode: invalid",
 			expectedErr: "Error response from daemon: invalid IPC mode: invalid",
 		},
 		},
 		{
 		{
 			doc:         "invalid PidMode",
 			doc:         "invalid PidMode",
-			hc:          containertypes.HostConfig{PidMode: "invalid"},
+			hc:          container.HostConfig{PidMode: "invalid"},
 			expectedErr: "Error response from daemon: invalid PID mode: invalid",
 			expectedErr: "Error response from daemon: invalid PID mode: invalid",
 		},
 		},
 		{
 		{
 			doc:         "invalid PidMode without container ID",
 			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",
 			expectedErr: "Error response from daemon: invalid PID mode: container",
 		},
 		},
 		{
 		{
 			doc:         "invalid UTSMode",
 			doc:         "invalid UTSMode",
-			hc:          containertypes.HostConfig{UTSMode: "invalid"},
+			hc:          container.HostConfig{UTSMode: "invalid"},
 			expectedErr: "Error response from daemon: invalid UTS mode: invalid",
 			expectedErr: "Error response from daemon: invalid UTS mode: invalid",
 		},
 		},
 		{
 		{
 			doc:         "invalid Annotations",
 			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",
 			expectedErr: "Error response from daemon: invalid Annotations: the empty string is not permitted as an annotation key",
 		},
 		},
 	}
 	}

+ 7 - 7
integration/container/daemon_linux_test.go

@@ -47,9 +47,9 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 
 
 	cID := container.Create(ctx, t, c)
 	cID := container.Create(ctx, t, c)
-	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	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")
 	assert.Check(t, err, "error starting test container")
 
 
 	inspect, err := c.ContainerInspect(ctx, cID)
 	inspect, err := c.ContainerInspect(ctx, cID)
@@ -68,7 +68,7 @@ func TestContainerStartOnDaemonRestart(t *testing.T) {
 
 
 	d.Start(t, "--iptables=false")
 	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")
 	assert.Check(t, err, "failed to start test container")
 }
 }
 
 
@@ -105,7 +105,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
 		container.WithCmd("top"),
 		container.WithCmd("top"),
 		container.WithRestartPolicy(containertypes.RestartPolicyAlways),
 		container.WithRestartPolicy(containertypes.RestartPolicyAlways),
 	)
 	)
-	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 	inspect, err := c.ContainerInspect(ctx, cID)
 	inspect, err := c.ContainerInspect(ctx, cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -121,7 +121,7 @@ func TestDaemonRestartIpcMode(t *testing.T) {
 
 
 	// check a new container is created with shareable ipc mode as per new daemon default
 	// check a new container is created with shareable ipc mode as per new daemon default
 	cID = container.Run(ctx, t, c)
 	cID = container.Run(ctx, t, c)
-	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 	inspect, err = c.ContainerInspect(ctx, cID)
 	inspect, err = c.ContainerInspect(ctx, cID)
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -156,7 +156,7 @@ func TestDaemonHostGatewayIP(t *testing.T) {
 	inspect, err := c.NetworkInspect(ctx, "bridge", types.NetworkInspectOptions{})
 	inspect, err := c.NetworkInspect(ctx, "bridge", types.NetworkInspectOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Contains(res.Stdout(), inspect.IPAM.Config[0].Gateway))
 	assert.Check(t, is.Contains(res.Stdout(), inspect.IPAM.Config[0].Gateway))
-	c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 	d.Stop(t)
 	d.Stop(t)
 
 
 	// Verify the IP in /etc/hosts is same as host-gateway-ip
 	// Verify the IP in /etc/hosts is same as host-gateway-ip
@@ -169,7 +169,7 @@ func TestDaemonHostGatewayIP(t *testing.T) {
 	assert.Assert(t, is.Len(res.Stderr(), 0))
 	assert.Assert(t, is.Len(res.Stderr(), 0))
 	assert.Equal(t, 0, res.ExitCode)
 	assert.Equal(t, 0, res.ExitCode)
 	assert.Check(t, is.Contains(res.Stdout(), "6.7.8.9"))
 	assert.Check(t, is.Contains(res.Stdout(), "6.7.8.9"))
-	c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 	d.Stop(t)
 	d.Stop(t)
 }
 }
 
 

+ 2 - 2
integration/container/daemon_test.go

@@ -3,7 +3,7 @@ package container
 import (
 import (
 	"testing"
 	"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/integration/internal/container"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil/daemon"
 	"github.com/docker/docker/testutil/daemon"
@@ -35,7 +35,7 @@ func TestContainerKillOnDaemonStart(t *testing.T) {
 	// Sadly this means the test will take longer, but at least this test can be parallelized.
 	// Sadly this means the test will take longer, but at least this test can be parallelized.
 	id := container.Run(ctx, t, apiClient, container.WithCmd("/bin/sh", "-c", "while true; do echo hello; sleep 1; done"))
 	id := container.Run(ctx, t, apiClient, container.WithCmd("/bin/sh", "-c", "while true; do echo hello; sleep 1; done"))
 	defer func() {
 	defer func() {
-		err := apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
+		err := apiClient.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 	}()
 	}()
 
 

+ 1 - 2
integration/container/devices_windows_test.go

@@ -4,7 +4,6 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/testutil"
 	"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.
 			// 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")
 			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 {
 			if d.expectedStartFailure {
 				assert.ErrorContains(t, err, d.expectedStartFailureMessage)
 				assert.ErrorContains(t, err, d.expectedStartFailureMessage)
 				return
 				return

+ 5 - 6
integration/container/ipcmode_linux_test.go

@@ -7,7 +7,6 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
@@ -68,7 +67,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
 	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)
 	assert.NilError(t, err)
 
 
 	// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
 	// 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))
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
 	name1 := resp.ID
 	name1 := resp.ID
 
 
-	err = apiClient.ContainerStart(ctx, name1, types.ContainerStartOptions{})
+	err = apiClient.ContainerStart(ctx, name1, containertypes.StartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	// create and start the second container
 	// 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))
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
 	name2 := resp.ID
 	name2 := resp.ID
 
 
-	err = apiClient.ContainerStart(ctx, name2, types.ContainerStartOptions{})
+	err = apiClient.ContainerStart(ctx, name2, containertypes.StartOptions{})
 	if !mustWork {
 	if !mustWork {
 		// start should fail with a specific error
 		// start should fail with a specific error
 		assert.Check(t, is.ErrorContains(err, "non-shareable IPC"))
 		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))
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
 	name := resp.ID
 	name := resp.ID
 
 
-	err = apiClient.ContainerStart(ctx, name, types.ContainerStartOptions{})
+	err = apiClient.ContainerStart(ctx, name, containertypes.StartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	// check that IPC is shared
 	// check that IPC is shared
@@ -241,7 +240,7 @@ func testDaemonIpcPrivateShareable(t *testing.T, mustBeShared bool, arg ...strin
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(len(resp.Warnings), 0))
 	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)
 	assert.NilError(t, err)
 
 
 	// get major:minor pair for /dev/shm from container's /proc/self/mountinfo
 	// get major:minor pair for /dev/shm from container's /proc/self/mountinfo

+ 2 - 2
integration/container/links_linux_test.go

@@ -4,7 +4,7 @@ import (
 	"os"
 	"os"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	containertypes "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/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
@@ -43,7 +43,7 @@ func TestLinksContainerNames(t *testing.T) {
 	container.Run(ctx, t, apiClient, container.WithName(containerA))
 	container.Run(ctx, t, apiClient, container.WithName(containerA))
 	container.Run(ctx, t, apiClient, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
 	container.Run(ctx, t, apiClient, container.WithName(containerB), container.WithLinks(containerA+":"+containerA))
 
 
-	containers, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
+	containers, err := apiClient.ContainerList(ctx, containertypes.ListOptions{
 		Filters: filters.NewArgs(filters.Arg("name", containerA)),
 		Filters: filters.NewArgs(filters.Arg("name", containerA)),
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 10 - 10
integration/container/logs_test.go

@@ -7,7 +7,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/daemon/logger/jsonfilelog"
 	"github.com/docker/docker/daemon/logger/jsonfilelog"
 	"github.com/docker/docker/daemon/logger/local"
 	"github.com/docker/docker/daemon/logger/local"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -29,7 +29,7 @@ func TestLogsFollowTailEmpty(t *testing.T) {
 
 
 	id := container.Run(ctx, t, apiClient, container.WithCmd("sleep", "100000"))
 	id := container.Run(ctx, t, apiClient, container.WithCmd("sleep", "100000"))
 
 
-	logs, err := apiClient.ContainerLogs(ctx, id, types.ContainerLogsOptions{ShowStdout: true, Tail: "2"})
+	logs, err := apiClient.ContainerLogs(ctx, id, containertypes.LogsOptions{ShowStdout: true, Tail: "2"})
 	if logs != nil {
 	if logs != nil {
 		defer logs.Close()
 		defer logs.Close()
 	}
 	}
@@ -55,7 +55,7 @@ func testLogs(t *testing.T, logDriver string) {
 
 
 	testCases := []struct {
 	testCases := []struct {
 		desc        string
 		desc        string
-		logOps      types.ContainerLogsOptions
+		logOps      containertypes.LogsOptions
 		expectedOut string
 		expectedOut string
 		expectedErr string
 		expectedErr string
 		tty         bool
 		tty         bool
@@ -64,7 +64,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "tty/stdout and stderr",
 			desc: "tty/stdout and stderr",
 			tty:  true,
 			tty:  true,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: true,
 				ShowStderr: true,
 			},
 			},
@@ -73,7 +73,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "tty/only stdout",
 			desc: "tty/only stdout",
 			tty:  true,
 			tty:  true,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: false,
 				ShowStderr: false,
 			},
 			},
@@ -82,7 +82,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "tty/only stderr",
 			desc: "tty/only stderr",
 			tty:  true,
 			tty:  true,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: false,
 				ShowStdout: false,
 				ShowStderr: true,
 				ShowStderr: true,
 			},
 			},
@@ -92,7 +92,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "without tty/stdout and stderr",
 			desc: "without tty/stdout and stderr",
 			tty:  false,
 			tty:  false,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: true,
 				ShowStderr: true,
 			},
 			},
@@ -102,7 +102,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "without tty/only stdout",
 			desc: "without tty/only stdout",
 			tty:  false,
 			tty:  false,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: true,
 				ShowStdout: true,
 				ShowStderr: false,
 				ShowStderr: false,
 			},
 			},
@@ -112,7 +112,7 @@ func testLogs(t *testing.T, logDriver string) {
 		{
 		{
 			desc: "without tty/only stderr",
 			desc: "without tty/only stderr",
 			tty:  false,
 			tty:  false,
-			logOps: types.ContainerLogsOptions{
+			logOps: containertypes.LogsOptions{
 				ShowStdout: false,
 				ShowStdout: false,
 				ShowStderr: true,
 				ShowStderr: true,
 			},
 			},
@@ -136,7 +136,7 @@ func testLogs(t *testing.T, logDriver string) {
 				container.WithTty(tty),
 				container.WithTty(tty),
 				container.WithLogDriver(logDriver),
 				container.WithLogDriver(logDriver),
 			)
 			)
-			defer apiClient.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
+			defer apiClient.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true})
 
 
 			poll.WaitOn(t, container.IsStopped(ctx, apiClient, id),
 			poll.WaitOn(t, container.IsStopped(ctx, apiClient, id),
 				poll.WithDelay(time.Millisecond*100),
 				poll.WithDelay(time.Millisecond*100),

+ 2 - 3
integration/container/mounts_linux_test.go

@@ -8,7 +8,6 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	mounttypes "github.com/docker/docker/api/types/mount"
 	"github.com/docker/docker/api/types/network"
 	"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, "")
 	ctrCreate, err := cli.ContainerCreate(ctx, &config, &hostConfig, &network.NetworkingConfig{}, nil, "")
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	// container will exit immediately because of no tty, but we only need the start sequence to test the condition
 	// 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)
 	assert.NilError(t, err)
 
 
 	// Check that host-located bind mount network file did not change ownership when the container was started
 	// Check that host-located bind mount network file did not change ownership when the container was started
@@ -192,7 +191,7 @@ func TestMountDaemonRoot(t *testing.T) {
 					}
 					}
 
 
 					defer func() {
 					defer func() {
-						if err := apiClient.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{Force: true}); err != nil {
+						if err := apiClient.ContainerRemove(ctx, c.ID, containertypes.RemoveOptions{Force: true}); err != nil {
 							panic(err)
 							panic(err)
 						}
 						}
 					}()
 					}()

+ 2 - 2
integration/container/nat_test.go

@@ -10,7 +10,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"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/integration/internal/container"
 	"github.com/docker/go-connections/nat"
 	"github.com/docker/go-connections/nat"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
@@ -77,7 +77,7 @@ func TestNetworkLoopbackNat(t *testing.T) {
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 
 
-	body, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{
+	body, err := apiClient.ContainerLogs(ctx, cID, containertypes.LogsOptions{
 		ShowStdout: true,
 		ShowStdout: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)

+ 3 - 3
integration/container/pidmode_linux_test.go

@@ -4,7 +4,7 @@ import (
 	"os"
 	"os"
 	"testing"
 	"testing"
 
 
-	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"gotest.tools/v3/assert"
 	"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)))
 		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")
 		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.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, "failed to join PID namespace"))
 		assert.Check(t, is.ErrorContains(err, cPIDContainerID+" is not running"))
 		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)))
 		ctr, err := container.CreateFromConfig(ctx, apiClient, container.NewTestConfig(container.WithPIDMode("container:"+pidCtrName)))
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
-		err = apiClient.ContainerStart(ctx, ctr.ID, types.ContainerStartOptions{})
+		err = apiClient.ContainerStart(ctx, ctr.ID, containertypes.StartOptions{})
 		assert.Check(t, err)
 		assert.Check(t, err)
 	})
 	})
 }
 }

+ 3 - 2
integration/container/ps_test.go

@@ -4,6 +4,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "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/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -29,7 +30,7 @@ func TestPsFilter(t *testing.T) {
 
 
 	t.Run("since", func(t *testing.T) {
 	t.Run("since", func(t *testing.T) {
 		ctx := testutil.StartSpan(ctx, t)
 		ctx := testutil.StartSpan(ctx, t)
-		results, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
+		results, err := apiClient.ContainerList(ctx, containertypes.ListOptions{
 			All:     true,
 			All:     true,
 			Filters: filters.NewArgs(filters.Arg("since", top)),
 			Filters: filters.NewArgs(filters.Arg("since", top)),
 		})
 		})
@@ -39,7 +40,7 @@ func TestPsFilter(t *testing.T) {
 
 
 	t.Run("before", func(t *testing.T) {
 	t.Run("before", func(t *testing.T) {
 		ctx := testutil.StartSpan(ctx, t)
 		ctx := testutil.StartSpan(ctx, t)
-		results, err := apiClient.ContainerList(ctx, types.ContainerListOptions{
+		results, err := apiClient.ContainerList(ctx, containertypes.ListOptions{
 			All:     true,
 			All:     true,
 			Filters: filters.NewArgs(filters.Arg("before", top)),
 			Filters: filters.NewArgs(filters.Arg("before", top)),
 		})
 		})

+ 6 - 6
integration/container/remove_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
+	containertypes "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/api/types/volume"
 	"github.com/docker/docker/api/types/volume"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
@@ -42,7 +42,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
 	err := os.RemoveAll(tempDir.Path())
 	err := os.RemoveAll(tempDir.Path())
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	err = apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
+	err = apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{
 		RemoveVolumes: true,
 		RemoveVolumes: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -67,7 +67,7 @@ func TestRemoveContainerWithVolume(t *testing.T) {
 	assert.Check(t, is.Equal(1, len(insp.Mounts)))
 	assert.Check(t, is.Equal(1, len(insp.Mounts)))
 	volName := insp.Mounts[0].Name
 	volName := insp.Mounts[0].Name
 
 
-	err = apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
+	err = apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{
 		RemoveVolumes: true,
 		RemoveVolumes: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -85,7 +85,7 @@ func TestRemoveContainerRunning(t *testing.T) {
 
 
 	cID := container.Run(ctx, t, apiClient)
 	cID := container.Run(ctx, t, apiClient)
 
 
-	err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{})
+	err := apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
 	assert.Check(t, is.ErrorType(err, errdefs.IsConflict))
 	assert.Check(t, is.ErrorContains(err, "container is running"))
 	assert.Check(t, is.ErrorContains(err, "container is running"))
 }
 }
@@ -96,7 +96,7 @@ func TestRemoveContainerForceRemoveRunning(t *testing.T) {
 
 
 	cID := container.Run(ctx, t, apiClient)
 	cID := container.Run(ctx, t, apiClient)
 
 
-	err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{
+	err := apiClient.ContainerRemove(ctx, cID, containertypes.RemoveOptions{
 		Force: true,
 		Force: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -106,7 +106,7 @@ func TestRemoveInvalidContainer(t *testing.T) {
 	ctx := setupTest(t)
 	ctx := setupTest(t)
 	apiClient := testEnv.APIClient()
 	apiClient := testEnv.APIClient()
 
 
-	err := apiClient.ContainerRemove(ctx, "unknown", types.ContainerRemoveOptions{})
+	err := apiClient.ContainerRemove(ctx, "unknown", containertypes.RemoveOptions{})
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	assert.Check(t, is.ErrorType(err, errdefs.IsNotFound))
 	assert.Check(t, is.ErrorContains(err, "No such container"))
 	assert.Check(t, is.ErrorContains(err, "No such container"))
 }
 }

+ 2 - 2
integration/container/rename_test.go

@@ -36,7 +36,7 @@ func TestRenameLinkedContainer(t *testing.T) {
 
 
 	container.Run(ctx, t, apiClient, container.WithName(aName))
 	container.Run(ctx, t, apiClient, container.WithName(aName))
 
 
-	err = apiClient.ContainerRemove(ctx, bID, types.ContainerRemoveOptions{Force: true})
+	err = apiClient.ContainerRemove(ctx, bID, containertypes.RemoveOptions{Force: true})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	bID = container.Run(ctx, t, apiClient, container.WithName(bName), container.WithLinks(aName))
 	bID = container.Run(ctx, t, apiClient, container.WithName(bName), container.WithLinks(aName))
@@ -135,7 +135,7 @@ func TestRenameAnonymousContainer(t *testing.T) {
 	// FIXME(vdemeester) this is a really weird behavior as it fails otherwise
 	// FIXME(vdemeester) this is a really weird behavior as it fails otherwise
 	err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
 	err = apiClient.ContainerStop(ctx, container1Name, containertypes.StopOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
-	err = apiClient.ContainerStart(ctx, container1Name, types.ContainerStartOptions{})
+	err = apiClient.ContainerStart(ctx, container1Name, containertypes.StartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	count := "-c"
 	count := "-c"

+ 3 - 3
integration/container/resize_test.go

@@ -4,7 +4,7 @@ import (
 	"net/http"
 	"net/http"
 	"testing"
 	"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/api/types/versions"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -20,7 +20,7 @@ func TestResize(t *testing.T) {
 
 
 	t.Run("success", func(t *testing.T) {
 	t.Run("success", func(t *testing.T) {
 		cID := container.Run(ctx, t, apiClient, container.WithTty(true))
 		cID := container.Run(ctx, t, apiClient, container.WithTty(true))
-		err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
+		err := apiClient.ContainerResize(ctx, cID, containertypes.ResizeOptions{
 			Height: 40,
 			Height: 40,
 			Width:  40,
 			Width:  40,
 		})
 		})
@@ -46,7 +46,7 @@ func TestResize(t *testing.T) {
 
 
 	t.Run("invalid state", func(t *testing.T) {
 	t.Run("invalid state", func(t *testing.T) {
 		cID := container.Create(ctx, t, apiClient, container.WithCmd("echo"))
 		cID := container.Create(ctx, t, apiClient, container.WithCmd("echo"))
-		err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
+		err := apiClient.ContainerResize(ctx, cID, containertypes.ResizeOptions{
 			Height: 40,
 			Height: 40,
 			Width:  40,
 			Width:  40,
 		})
 		})

+ 3 - 4
integration/container/restart_test.go

@@ -6,7 +6,6 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	testContainer "github.com/docker/docker/integration/internal/container"
 	testContainer "github.com/docker/docker/integration/internal/container"
@@ -102,10 +101,10 @@ func TestDaemonRestartKillContainers(t *testing.T) {
 
 
 					resp, err := apiClient.ContainerCreate(ctx, tc.config, tc.hostConfig, nil, nil, "")
 					resp, err := apiClient.ContainerCreate(ctx, tc.config, tc.hostConfig, nil, nil, "")
 					assert.NilError(t, err)
 					assert.NilError(t, err)
-					defer apiClient.ContainerRemove(ctx, resp.ID, types.ContainerRemoveOptions{Force: true})
+					defer apiClient.ContainerRemove(ctx, resp.ID, container.RemoveOptions{Force: true})
 
 
 					if tc.xStart {
 					if tc.xStart {
-						err = apiClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{})
+						err = apiClient.ContainerStart(ctx, resp.ID, container.StartOptions{})
 						assert.NilError(t, err)
 						assert.NilError(t, err)
 					}
 					}
 
 
@@ -192,7 +191,7 @@ func TestContainerWithAutoRemoveCanBeRestarted(t *testing.T) {
 				testContainer.WithAutoRemove,
 				testContainer.WithAutoRemove,
 			)
 			)
 			defer func() {
 			defer func() {
-				err := apiClient.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+				err := apiClient.ContainerRemove(ctx, cID, container.RemoveOptions{Force: true})
 				if t.Failed() && err != nil {
 				if t.Failed() && err != nil {
 					t.Logf("Cleaning up test container failed with error: %v", err)
 					t.Logf("Cleaning up test container failed with error: %v", err)
 				}
 				}

+ 4 - 5
integration/container/run_linux_test.go

@@ -10,7 +10,6 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -191,7 +190,7 @@ func TestRunConsoleSize(t *testing.T) {
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 
 
-	out, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
+	out, err := apiClient.ContainerLogs(ctx, cID, containertypes.LogsOptions{ShowStdout: true})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	defer out.Close()
 	defer out.Close()
 
 
@@ -246,7 +245,7 @@ func TestRunWithAlternativeContainerdShim(t *testing.T) {
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 
 
-	out, err := apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
+	out, err := apiClient.ContainerLogs(ctx, cID, containertypes.LogsOptions{ShowStdout: true})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	defer out.Close()
 	defer out.Close()
 
 
@@ -266,7 +265,7 @@ func TestRunWithAlternativeContainerdShim(t *testing.T) {
 
 
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 	poll.WaitOn(t, container.IsStopped(ctx, apiClient, cID), poll.WithDelay(100*time.Millisecond))
 
 
-	out, err = apiClient.ContainerLogs(ctx, cID, types.ContainerLogsOptions{ShowStdout: true})
+	out, err = apiClient.ContainerLogs(ctx, cID, containertypes.LogsOptions{ShowStdout: true})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	defer out.Close()
 	defer out.Close()
 
 
@@ -297,7 +296,7 @@ func TestMacAddressIsAppliedToMainNetworkWithShortID(t *testing.T) {
 		container.WithStopSignal("SIGKILL"),
 		container.WithStopSignal("SIGKILL"),
 		container.WithNetworkMode(n[:10]),
 		container.WithNetworkMode(n[:10]),
 		container.WithMacAddress("02:42:08:26:a9:55"))
 		container.WithMacAddress("02:42:08:26:a9:55"))
-	defer container.Remove(ctx, t, apiClient, cid, types.ContainerRemoveOptions{Force: true})
+	defer container.Remove(ctx, t, apiClient, cid, containertypes.RemoveOptions{Force: true})
 
 
 	c := container.Inspect(ctx, t, apiClient, cid)
 	c := container.Inspect(ctx, t, apiClient, cid)
 	assert.Equal(t, c.NetworkSettings.Networks["testnet"].MacAddress, "02:42:08:26:a9:55")
 	assert.Equal(t, c.NetworkSettings.Networks["testnet"].MacAddress, "02:42:08:26:a9:55")

+ 1 - 2
integration/container/stop_linux_test.go

@@ -9,7 +9,6 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
@@ -128,7 +127,7 @@ func TestStopContainerWithTimeoutCancel(t *testing.T) {
 // logsContains verifies the container contains the given text in the log's stdout.
 // logsContains verifies the container contains the given text in the log's stdout.
 func logsContains(ctx context.Context, client client.APIClient, containerID string, logString string) func(log poll.LogT) poll.Result {
 func logsContains(ctx context.Context, client client.APIClient, containerID string, logString string) func(log poll.LogT) poll.Result {
 	return func(log poll.LogT) poll.Result {
 	return func(log poll.LogT) poll.Result {
-		logs, err := client.ContainerLogs(ctx, containerID, types.ContainerLogsOptions{
+		logs, err := client.ContainerLogs(ctx, containerID, containertypes.LogsOptions{
 			ShowStdout: true,
 			ShowStdout: true,
 		})
 		})
 		if err != nil {
 		if err != nil {

+ 3 - 4
integration/container/wait_test.go

@@ -4,7 +4,6 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -145,11 +144,11 @@ func TestWaitConditions(t *testing.T) {
 			containerID := container.Create(ctx, t, cli, opts...)
 			containerID := container.Create(ctx, t, cli, opts...)
 			t.Logf("ContainerID = %v", containerID)
 			t.Logf("ContainerID = %v", containerID)
 
 
-			streams, err := cli.ContainerAttach(ctx, containerID, types.ContainerAttachOptions{Stream: true, Stdin: true})
+			streams, err := cli.ContainerAttach(ctx, containerID, containertypes.AttachOptions{Stream: true, Stdin: true})
 			assert.NilError(t, err)
 			assert.NilError(t, err)
 			defer streams.Close()
 			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)
 			waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond)
 			select {
 			select {
 			case err := <-errC:
 			case err := <-errC:
@@ -210,7 +209,7 @@ func TestWaitRestartedContainer(t *testing.T) {
 			containerID := container.Run(ctx, t, cli,
 			containerID := container.Run(ctx, t, cli,
 				container.WithCmd("sh", "-c", "trap 'exit 5' SIGTERM; while true; do sleep 0.1; done"),
 				container.WithCmd("sh", "-c", "trap 'exit 5' SIGTERM; while true; do sleep 0.1; done"),
 			)
 			)
-			defer cli.ContainerRemove(ctx, containerID, types.ContainerRemoveOptions{Force: true})
+			defer cli.ContainerRemove(ctx, containerID, containertypes.RemoveOptions{Force: true})
 
 
 			// Container is running now, wait for exit
 			// Container is running now, wait for exit
 			waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond)
 			waitResC, errC := cli.ContainerWait(ctx, containerID, tc.waitCond)

+ 7 - 7
integration/daemon/daemon_test.go

@@ -410,7 +410,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 				Target: "/foo",
 				Target: "/foo",
 			}
 			}
 			cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("top"), container.WithRestartPolicy(policy))
 			cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("top"), container.WithRestartPolicy(policy))
-			defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+			defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 			// Stop the daemon
 			// Stop the daemon
 			d.Restart(t, "--live-restore", "--iptables=false")
 			d.Restart(t, "--live-restore", "--iptables=false")
@@ -452,7 +452,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 
 
 		const testContent = "hello"
 		const testContent = "hello"
 		cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("sh", "-c", "echo "+testContent+">>/foo/test.txt; sleep infinity"))
 		cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("sh", "-c", "echo "+testContent+">>/foo/test.txt; sleep infinity"))
-		defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+		defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 		// Wait until container creates a file in the volume.
 		// Wait until container creates a file in the volume.
 		poll.WaitOn(t, func(t poll.LogT) poll.Result {
 		poll.WaitOn(t, func(t poll.LogT) poll.Result {
@@ -484,7 +484,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 			// Check if a new container with the same volume has access to the previous content.
 			// Check if a new container with the same volume has access to the previous content.
 			// This fails if the volume gets unmounted at startup.
 			// This fails if the volume gets unmounted at startup.
 			cID2 := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("cat", "/foo/test.txt"))
 			cID2 := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("cat", "/foo/test.txt"))
-			defer c.ContainerRemove(ctx, cID2, types.ContainerRemoveOptions{Force: true})
+			defer c.ContainerRemove(ctx, cID2, containertypes.RemoveOptions{Force: true})
 
 
 			poll.WaitOn(t, container.IsStopped(ctx, c, cID2))
 			poll.WaitOn(t, container.IsStopped(ctx, c, cID2))
 
 
@@ -493,7 +493,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 				assert.Check(t, is.Equal(inspect.State.ExitCode, 0), "volume doesn't have the same file")
 				assert.Check(t, is.Equal(inspect.State.ExitCode, 0), "volume doesn't have the same file")
 			}
 			}
 
 
-			logs, err := c.ContainerLogs(ctx, cID2, types.ContainerLogsOptions{ShowStdout: true})
+			logs, err := c.ContainerLogs(ctx, cID2, containertypes.LogsOptions{ShowStdout: true})
 			assert.NilError(t, err)
 			assert.NilError(t, err)
 			defer logs.Close()
 			defer logs.Close()
 
 
@@ -505,7 +505,7 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 		})
 		})
 
 
 		// Remove that container which should free the references in the volume
 		// Remove that container which should free the references in the volume
-		err = c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+		err = c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		// Now we should be able to remove the volume
 		// Now we should be able to remove the volume
@@ -524,11 +524,11 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
 			Target: "/foo",
 			Target: "/foo",
 		}
 		}
 		cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("top"))
 		cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("top"))
-		defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+		defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 		d.Restart(t, "--live-restore", "--iptables=false")
 		d.Restart(t, "--live-restore", "--iptables=false")
 
 
-		err := c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+		err := c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 	})
 	})
 }
 }

+ 3 - 3
integration/image/commit_test.go

@@ -4,7 +4,7 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"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/api/types/versions"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
@@ -22,7 +22,7 @@ func TestCommitInheritsEnv(t *testing.T) {
 	cID1 := container.Create(ctx, t, client)
 	cID1 := container.Create(ctx, t, client)
 	imgName := strings.ToLower(t.Name())
 	imgName := strings.ToLower(t.Name())
 
 
-	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
+	commitResp1, err := client.ContainerCommit(ctx, cID1, containertypes.CommitOptions{
 		Changes:   []string{"ENV PATH=/bin"},
 		Changes:   []string{"ENV PATH=/bin"},
 		Reference: imgName,
 		Reference: imgName,
 	})
 	})
@@ -36,7 +36,7 @@ func TestCommitInheritsEnv(t *testing.T) {
 
 
 	cID2 := container.Create(ctx, t, client, container.WithImage(image1.ID))
 	cID2 := container.Create(ctx, t, client, container.WithImage(image1.ID))
 
 
-	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
+	commitResp2, err := client.ContainerCommit(ctx, cID2, containertypes.CommitOptions{
 		Changes:   []string{"ENV PATH=/usr/bin:$PATH"},
 		Changes:   []string{"ENV PATH=/usr/bin:$PATH"},
 		Reference: imgName,
 		Reference: imgName,
 	})
 	})

+ 2 - 1
integration/image/list_test.go

@@ -7,6 +7,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "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/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -70,7 +71,7 @@ func TestImagesFilterBeforeSince(t *testing.T) {
 			// Make really really sure each image has a distinct timestamp.
 			// Make really really sure each image has a distinct timestamp.
 			time.Sleep(time.Millisecond)
 			time.Sleep(time.Millisecond)
 		}
 		}
-		id, err := client.ContainerCommit(ctx, ctr, types.ContainerCommitOptions{Reference: fmt.Sprintf("%s:v%d", name, i)})
+		id, err := client.ContainerCommit(ctx, ctr, containertypes.CommitOptions{Reference: fmt.Sprintf("%s:v%d", name, i)})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 		imgs[i] = id.ID
 		imgs[i] = id.ID
 	}
 	}

+ 3 - 2
integration/image/remove_test.go

@@ -5,6 +5,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/errdefs"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
@@ -21,7 +22,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
 
 
 	// Create a container from busybox, and commit a small change so we have a new image
 	// Create a container from busybox, and commit a small change so we have a new image
 	cID1 := container.Create(ctx, t, client, container.WithCmd(""))
 	cID1 := container.Create(ctx, t, client, container.WithCmd(""))
-	commitResp1, err := client.ContainerCommit(ctx, cID1, types.ContainerCommitOptions{
+	commitResp1, err := client.ContainerCommit(ctx, cID1, containertypes.CommitOptions{
 		Changes:   []string{`ENTRYPOINT ["true"]`},
 		Changes:   []string{`ENTRYPOINT ["true"]`},
 		Reference: imgName,
 		Reference: imgName,
 	})
 	})
@@ -34,7 +35,7 @@ func TestRemoveImageOrphaning(t *testing.T) {
 
 
 	// Create a container from created image, and commit a small change with same reference name
 	// Create a container from created image, and commit a small change with same reference name
 	cID2 := container.Create(ctx, t, client, container.WithImage(imgName), container.WithCmd(""))
 	cID2 := container.Create(ctx, t, client, container.WithImage(imgName), container.WithCmd(""))
-	commitResp2, err := client.ContainerCommit(ctx, cID2, types.ContainerCommitOptions{
+	commitResp2, err := client.ContainerCommit(ctx, cID2, containertypes.CommitOptions{
 		Changes:   []string{`LABEL Maintainer="Integration Tests"`},
 		Changes:   []string{`LABEL Maintainer="Integration Tests"`},
 		Reference: imgName,
 		Reference: imgName,
 	})
 	})

+ 4 - 4
integration/image/save_test.go

@@ -16,7 +16,7 @@ import (
 
 
 	"github.com/cpuguy83/tar2go"
 	"github.com/cpuguy83/tar2go"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
-	containerapi "github.com/docker/docker/api/types/container"
+	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration/internal/build"
 	"github.com/docker/docker/integration/internal/build"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/archive"
@@ -91,7 +91,7 @@ func TestSaveRepoWithMultipleImages(t *testing.T) {
 			cfg.Config.Cmd = []string{"true"}
 			cfg.Config.Cmd = []string{"true"}
 		})
 		})
 
 
-		chW, chErr := client.ContainerWait(ctx, id, containerapi.WaitConditionNotRunning)
+		chW, chErr := client.ContainerWait(ctx, id, containertypes.WaitConditionNotRunning)
 
 
 		ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
 		ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
 		defer cancel()
 		defer cancel()
@@ -104,10 +104,10 @@ func TestSaveRepoWithMultipleImages(t *testing.T) {
 			t.Fatal("timeout waiting for container to exit")
 			t.Fatal("timeout waiting for container to exit")
 		}
 		}
 
 
-		res, err := client.ContainerCommit(ctx, id, types.ContainerCommitOptions{Reference: tag})
+		res, err := client.ContainerCommit(ctx, id, containertypes.CommitOptions{Reference: tag})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
-		err = client.ContainerRemove(ctx, id, types.ContainerRemoveOptions{Force: true})
+		err = client.ContainerRemove(ctx, id, containertypes.RemoveOptions{Force: true})
 		assert.NilError(t, err)
 		assert.NilError(t, err)
 
 
 		return res.ID
 		return res.ID

+ 4 - 4
integration/internal/container/container.go

@@ -77,7 +77,7 @@ func Run(ctx context.Context, t *testing.T, apiClient client.APIClient, ops ...f
 	t.Helper()
 	t.Helper()
 	id := Create(ctx, t, apiClient, ops...)
 	id := Create(ctx, t, apiClient, ops...)
 
 
-	err := apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
+	err := apiClient.ContainerStart(ctx, id, container.StartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	return id
 	return id
@@ -99,14 +99,14 @@ func RunAttach(ctx context.Context, t *testing.T, apiClient client.APIClient, op
 	})
 	})
 	id := Create(ctx, t, apiClient, ops...)
 	id := Create(ctx, t, apiClient, ops...)
 
 
-	aresp, err := apiClient.ContainerAttach(ctx, id, types.ContainerAttachOptions{
+	aresp, err := apiClient.ContainerAttach(ctx, id, container.AttachOptions{
 		Stream: true,
 		Stream: true,
 		Stdout: true,
 		Stdout: true,
 		Stderr: true,
 		Stderr: true,
 	})
 	})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
-	err = apiClient.ContainerStart(ctx, id, types.ContainerStartOptions{})
+	err = apiClient.ContainerStart(ctx, id, container.StartOptions{})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 
 
 	s, err := demultiplexStreams(ctx, aresp)
 	s, err := demultiplexStreams(ctx, aresp)
@@ -155,7 +155,7 @@ func demultiplexStreams(ctx context.Context, resp types.HijackedResponse) (strea
 	return s, err
 	return s, err
 }
 }
 
 
-func Remove(ctx context.Context, t *testing.T, apiClient client.APIClient, container string, options types.ContainerRemoveOptions) {
+func Remove(ctx context.Context, t *testing.T, apiClient client.APIClient, container string, options container.RemoveOptions) {
 	t.Helper()
 	t.Helper()
 
 
 	err := apiClient.ContainerRemove(ctx, container, options)
 	err := apiClient.ContainerRemove(ctx, container, options)

+ 2 - 2
integration/network/dns_test.go

@@ -4,7 +4,7 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"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/integration/internal/container"
 	"github.com/docker/docker/integration/internal/network"
 	"github.com/docker/docker/integration/internal/network"
 	"github.com/docker/docker/testutil"
 	"github.com/docker/docker/testutil"
@@ -29,7 +29,7 @@ func TestDaemonDNSFallback(t *testing.T) {
 	defer c.NetworkRemove(ctx, "test")
 	defer c.NetworkRemove(ctx, "test")
 
 
 	cid := container.Run(ctx, t, c, container.WithNetworkMode("test"), container.WithCmd("nslookup", "docker.com"))
 	cid := container.Run(ctx, t, c, container.WithNetworkMode("test"), container.WithCmd("nslookup", "docker.com"))
-	defer c.ContainerRemove(ctx, cid, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, cid, containertypes.RemoveOptions{Force: true})
 
 
 	poll.WaitOn(t, container.IsSuccessful(ctx, c, cid), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(10*time.Second))
 	poll.WaitOn(t, container.IsSuccessful(ctx, c, cid), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(10*time.Second))
 }
 }

+ 5 - 4
integration/network/network_test.go

@@ -10,6 +10,7 @@ import (
 	"testing"
 	"testing"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	ntypes "github.com/docker/docker/api/types/network"
 	ntypes "github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/network"
 	"github.com/docker/docker/integration/internal/network"
@@ -37,14 +38,14 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 
 
 	id1 := container.Run(ctx, t, c)
 	id1 := container.Run(ctx, t, c)
-	defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, id1, containertypes.RemoveOptions{Force: true})
 
 
 	result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
 	result, err := container.Exec(ctx, c, id1, []string{"ip", "l"})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
 	assert.Check(t, is.Equal(false, strings.Contains(result.Combined(), "eth0")), "There shouldn't be eth0 in container in default(bridge) mode when bridge network is disabled")
 	assert.Check(t, is.Equal(false, strings.Contains(result.Combined(), "eth0")), "There shouldn't be eth0 in container in default(bridge) mode when bridge network is disabled")
 
 
 	id2 := container.Run(ctx, t, c, container.WithNetworkMode("bridge"))
 	id2 := container.Run(ctx, t, c, container.WithNetworkMode("bridge"))
-	defer c.ContainerRemove(ctx, id2, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, id2, containertypes.RemoveOptions{Force: true})
 
 
 	result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
 	result, err = container.Exec(ctx, c, id2, []string{"ip", "l"})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -58,7 +59,7 @@ func TestRunContainerWithBridgeNone(t *testing.T) {
 	assert.NilError(t, err, "Failed to get current process network namespace: %+v", err)
 	assert.NilError(t, err, "Failed to get current process network namespace: %+v", err)
 
 
 	id3 := container.Run(ctx, t, c, container.WithNetworkMode("host"))
 	id3 := container.Run(ctx, t, c, container.WithNetworkMode("host"))
-	defer c.ContainerRemove(ctx, id3, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, id3, containertypes.RemoveOptions{Force: true})
 
 
 	result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})
 	result, err = container.Exec(ctx, c, id3, []string{"sh", "-c", nsCommand})
 	assert.NilError(t, err)
 	assert.NilError(t, err)
@@ -250,7 +251,7 @@ func TestDefaultNetworkOpts(t *testing.T) {
 
 
 			// Start a container to inspect the MTU of its network interface
 			// Start a container to inspect the MTU of its network interface
 			id1 := container.Run(ctx, t, c, container.WithNetworkMode(networkName))
 			id1 := container.Run(ctx, t, c, container.WithNetworkMode(networkName))
-			defer c.ContainerRemove(ctx, id1, types.ContainerRemoveOptions{Force: true})
+			defer c.ContainerRemove(ctx, id1, containertypes.RemoveOptions{Force: true})
 
 
 			result, err := container.Exec(ctx, c, id1, []string{"ip", "l", "show", "eth0"})
 			result, err := container.Exec(ctx, c, id1, []string{"ip", "l", "show", "eth0"})
 			assert.NilError(t, err)
 			assert.NilError(t, err)

+ 2 - 1
integration/plugin/authz/authz_plugin_test.go

@@ -18,6 +18,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
+	containertypes "github.com/docker/docker/api/types/container"
 	eventtypes "github.com/docker/docker/api/types/events"
 	eventtypes "github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration/internal/container"
 	"github.com/docker/docker/integration/internal/container"
@@ -387,7 +388,7 @@ func TestAuthzPluginEnsureContainerCopyToFrom(t *testing.T) {
 	c := d.NewClientT(t)
 	c := d.NewClientT(t)
 
 
 	cID := container.Run(ctx, t, c)
 	cID := container.Run(ctx, t, c)
-	defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+	defer c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
 
 
 	_, err = f.Seek(0, io.SeekStart)
 	_, err = f.Seek(0, io.SeekStart)
 	assert.NilError(t, err)
 	assert.NilError(t, err)

部分文件因文件數量過多而無法顯示