Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -22,9 +22,9 @@ type Backend interface {
|
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 | 24 |
type imageBackend interface {
|
| 25 |
- ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) |
|
| 25 |
+ ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]image.DeleteResponse, error) |
|
| 26 | 26 |
ImageHistory(ctx context.Context, imageName string) ([]*image.HistoryResponseItem, error) |
| 27 |
- Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) |
|
| 27 |
+ Images(ctx context.Context, opts types.ImageListOptions) ([]*image.Summary, error) |
|
| 28 | 28 |
GetImage(ctx context.Context, refOrID string, options image.GetImageOpts) (*dockerimage.Image, error) |
| 29 | 29 |
TagImage(ctx context.Context, id dockerimage.ID, newRef reference.Named) error |
| 30 | 30 |
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) |
| ... | ... |
@@ -353,7 +353,7 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er |
| 353 | 353 |
Data: img.Details.Metadata, |
| 354 | 354 |
}, |
| 355 | 355 |
RootFS: rootFSToAPIType(img.RootFS), |
| 356 |
- Metadata: types.ImageMetadata{
|
|
| 356 |
+ Metadata: opts.Metadata{
|
|
| 357 | 357 |
LastTagTime: img.Details.LastUpdated, |
| 358 | 358 |
}, |
| 359 | 359 |
}, nil |
| ... | ... |
@@ -1840,6 +1840,7 @@ definitions: |
| 1840 | 1840 |
x-nullable: true |
| 1841 | 1841 |
ImageSummary: |
| 1842 | 1842 |
type: "object" |
| 1843 |
+ x-go-name: "Summary" |
|
| 1843 | 1844 |
required: |
| 1844 | 1845 |
- Id |
| 1845 | 1846 |
- ParentId |
| ... | ... |
@@ -4477,6 +4478,7 @@ definitions: |
| 4477 | 4477 |
|
| 4478 | 4478 |
ImageDeleteResponseItem: |
| 4479 | 4479 |
type: "object" |
| 4480 |
+ x-go-name: "DeleteResponse" |
|
| 4480 | 4481 |
properties: |
| 4481 | 4482 |
Untagged: |
| 4482 | 4483 |
description: "The image ID of an image that was untagged" |
| 4483 | 4484 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,15 @@ |
| 0 |
+package image |
|
| 1 |
+ |
|
| 2 |
+// This file was generated by the swagger tool. |
|
| 3 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 4 |
+ |
|
| 5 |
+// DeleteResponse delete response |
|
| 6 |
+// swagger:model DeleteResponse |
|
| 7 |
+type DeleteResponse struct {
|
|
| 8 |
+ |
|
| 9 |
+ // The image ID of an image that was deleted |
|
| 10 |
+ Deleted string `json:"Deleted,omitempty"` |
|
| 11 |
+ |
|
| 12 |
+ // The image ID of an image that was untagged |
|
| 13 |
+ Untagged string `json:"Untagged,omitempty"` |
|
| 14 |
+} |
| 0 | 15 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,9 @@ |
| 0 |
+package image |
|
| 1 |
+ |
|
| 2 |
+import "time" |
|
| 3 |
+ |
|
| 4 |
+// Metadata contains engine-local data about the image. |
|
| 5 |
+type Metadata struct {
|
|
| 6 |
+ // LastTagTime is the date and time at which the image was last tagged. |
|
| 7 |
+ LastTagTime time.Time `json:",omitempty"` |
|
| 8 |
+} |
| 0 | 9 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,89 @@ |
| 0 |
+package image |
|
| 1 |
+ |
|
| 2 |
+// This file was generated by the swagger tool. |
|
| 3 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 4 |
+ |
|
| 5 |
+// Summary summary |
|
| 6 |
+// swagger:model Summary |
|
| 7 |
+type Summary struct {
|
|
| 8 |
+ |
|
| 9 |
+ // Number of containers using this image. Includes both stopped and running |
|
| 10 |
+ // containers. |
|
| 11 |
+ // |
|
| 12 |
+ // This size is not calculated by default, and depends on which API endpoint |
|
| 13 |
+ // is used. `-1` indicates that the value has not been set / calculated. |
|
| 14 |
+ // |
|
| 15 |
+ // Required: true |
|
| 16 |
+ Containers int64 `json:"Containers"` |
|
| 17 |
+ |
|
| 18 |
+ // Date and time at which the image was created as a Unix timestamp |
|
| 19 |
+ // (number of seconds sinds EPOCH). |
|
| 20 |
+ // |
|
| 21 |
+ // Required: true |
|
| 22 |
+ Created int64 `json:"Created"` |
|
| 23 |
+ |
|
| 24 |
+ // ID is the content-addressable ID of an image. |
|
| 25 |
+ // |
|
| 26 |
+ // This identifier is a content-addressable digest calculated from the |
|
| 27 |
+ // image's configuration (which includes the digests of layers used by |
|
| 28 |
+ // the image). |
|
| 29 |
+ // |
|
| 30 |
+ // Note that this digest differs from the `RepoDigests` below, which |
|
| 31 |
+ // holds digests of image manifests that reference the image. |
|
| 32 |
+ // |
|
| 33 |
+ // Required: true |
|
| 34 |
+ ID string `json:"Id"` |
|
| 35 |
+ |
|
| 36 |
+ // User-defined key/value metadata. |
|
| 37 |
+ // Required: true |
|
| 38 |
+ Labels map[string]string `json:"Labels"` |
|
| 39 |
+ |
|
| 40 |
+ // ID of the parent image. |
|
| 41 |
+ // |
|
| 42 |
+ // Depending on how the image was created, this field may be empty and |
|
| 43 |
+ // is only set for images that were built/created locally. This field |
|
| 44 |
+ // is empty if the image was pulled from an image registry. |
|
| 45 |
+ // |
|
| 46 |
+ // Required: true |
|
| 47 |
+ ParentID string `json:"ParentId"` |
|
| 48 |
+ |
|
| 49 |
+ // List of content-addressable digests of locally available image manifests |
|
| 50 |
+ // that the image is referenced from. Multiple manifests can refer to the |
|
| 51 |
+ // same image. |
|
| 52 |
+ // |
|
| 53 |
+ // These digests are usually only available if the image was either pulled |
|
| 54 |
+ // from a registry, or if the image was pushed to a registry, which is when |
|
| 55 |
+ // the manifest is generated and its digest calculated. |
|
| 56 |
+ // |
|
| 57 |
+ // Required: true |
|
| 58 |
+ RepoDigests []string `json:"RepoDigests"` |
|
| 59 |
+ |
|
| 60 |
+ // List of image names/tags in the local image cache that reference this |
|
| 61 |
+ // image. |
|
| 62 |
+ // |
|
| 63 |
+ // Multiple image tags can refer to the same image, and this list may be |
|
| 64 |
+ // empty if no tags reference the image, in which case the image is |
|
| 65 |
+ // "untagged", in which case it can still be referenced by its ID. |
|
| 66 |
+ // |
|
| 67 |
+ // Required: true |
|
| 68 |
+ RepoTags []string `json:"RepoTags"` |
|
| 69 |
+ |
|
| 70 |
+ // Total size of image layers that are shared between this image and other |
|
| 71 |
+ // images. |
|
| 72 |
+ // |
|
| 73 |
+ // This size is not calculated by default. `-1` indicates that the value |
|
| 74 |
+ // has not been set / calculated. |
|
| 75 |
+ // |
|
| 76 |
+ // Required: true |
|
| 77 |
+ SharedSize int64 `json:"SharedSize"` |
|
| 78 |
+ |
|
| 79 |
+ // Total size of the image including all layers it is composed of. |
|
| 80 |
+ // |
|
| 81 |
+ // Required: true |
|
| 82 |
+ Size int64 `json:"Size"` |
|
| 83 |
+ |
|
| 84 |
+ // Total size of the image including all layers it is composed of. |
|
| 85 |
+ // |
|
| 86 |
+ // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. |
|
| 87 |
+ VirtualSize int64 `json:"VirtualSize,omitempty"` |
|
| 88 |
+} |
| 0 | 89 |
deleted file mode 100644 |
| ... | ... |
@@ -1,15 +0,0 @@ |
| 1 |
-package types |
|
| 2 |
- |
|
| 3 |
-// This file was generated by the swagger tool. |
|
| 4 |
-// Editing this file might prove futile when you re-run the swagger generate command |
|
| 5 |
- |
|
| 6 |
-// ImageDeleteResponseItem image delete response item |
|
| 7 |
-// swagger:model ImageDeleteResponseItem |
|
| 8 |
-type ImageDeleteResponseItem struct {
|
|
| 9 |
- |
|
| 10 |
- // The image ID of an image that was deleted |
|
| 11 |
- Deleted string `json:"Deleted,omitempty"` |
|
| 12 |
- |
|
| 13 |
- // The image ID of an image that was untagged |
|
| 14 |
- Untagged string `json:"Untagged,omitempty"` |
|
| 15 |
-} |
| 16 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,89 +0,0 @@ |
| 1 |
-package types |
|
| 2 |
- |
|
| 3 |
-// This file was generated by the swagger tool. |
|
| 4 |
-// Editing this file might prove futile when you re-run the swagger generate command |
|
| 5 |
- |
|
| 6 |
-// ImageSummary image summary |
|
| 7 |
-// swagger:model ImageSummary |
|
| 8 |
-type ImageSummary struct {
|
|
| 9 |
- |
|
| 10 |
- // Number of containers using this image. Includes both stopped and running |
|
| 11 |
- // containers. |
|
| 12 |
- // |
|
| 13 |
- // This size is not calculated by default, and depends on which API endpoint |
|
| 14 |
- // is used. `-1` indicates that the value has not been set / calculated. |
|
| 15 |
- // |
|
| 16 |
- // Required: true |
|
| 17 |
- Containers int64 `json:"Containers"` |
|
| 18 |
- |
|
| 19 |
- // Date and time at which the image was created as a Unix timestamp |
|
| 20 |
- // (number of seconds sinds EPOCH). |
|
| 21 |
- // |
|
| 22 |
- // Required: true |
|
| 23 |
- Created int64 `json:"Created"` |
|
| 24 |
- |
|
| 25 |
- // ID is the content-addressable ID of an image. |
|
| 26 |
- // |
|
| 27 |
- // This identifier is a content-addressable digest calculated from the |
|
| 28 |
- // image's configuration (which includes the digests of layers used by |
|
| 29 |
- // the image). |
|
| 30 |
- // |
|
| 31 |
- // Note that this digest differs from the `RepoDigests` below, which |
|
| 32 |
- // holds digests of image manifests that reference the image. |
|
| 33 |
- // |
|
| 34 |
- // Required: true |
|
| 35 |
- ID string `json:"Id"` |
|
| 36 |
- |
|
| 37 |
- // User-defined key/value metadata. |
|
| 38 |
- // Required: true |
|
| 39 |
- Labels map[string]string `json:"Labels"` |
|
| 40 |
- |
|
| 41 |
- // ID of the parent image. |
|
| 42 |
- // |
|
| 43 |
- // Depending on how the image was created, this field may be empty and |
|
| 44 |
- // is only set for images that were built/created locally. This field |
|
| 45 |
- // is empty if the image was pulled from an image registry. |
|
| 46 |
- // |
|
| 47 |
- // Required: true |
|
| 48 |
- ParentID string `json:"ParentId"` |
|
| 49 |
- |
|
| 50 |
- // List of content-addressable digests of locally available image manifests |
|
| 51 |
- // that the image is referenced from. Multiple manifests can refer to the |
|
| 52 |
- // same image. |
|
| 53 |
- // |
|
| 54 |
- // These digests are usually only available if the image was either pulled |
|
| 55 |
- // from a registry, or if the image was pushed to a registry, which is when |
|
| 56 |
- // the manifest is generated and its digest calculated. |
|
| 57 |
- // |
|
| 58 |
- // Required: true |
|
| 59 |
- RepoDigests []string `json:"RepoDigests"` |
|
| 60 |
- |
|
| 61 |
- // List of image names/tags in the local image cache that reference this |
|
| 62 |
- // image. |
|
| 63 |
- // |
|
| 64 |
- // Multiple image tags can refer to the same image, and this list may be |
|
| 65 |
- // empty if no tags reference the image, in which case the image is |
|
| 66 |
- // "untagged", in which case it can still be referenced by its ID. |
|
| 67 |
- // |
|
| 68 |
- // Required: true |
|
| 69 |
- RepoTags []string `json:"RepoTags"` |
|
| 70 |
- |
|
| 71 |
- // Total size of image layers that are shared between this image and other |
|
| 72 |
- // images. |
|
| 73 |
- // |
|
| 74 |
- // This size is not calculated by default. `-1` indicates that the value |
|
| 75 |
- // has not been set / calculated. |
|
| 76 |
- // |
|
| 77 |
- // Required: true |
|
| 78 |
- SharedSize int64 `json:"SharedSize"` |
|
| 79 |
- |
|
| 80 |
- // Total size of the image including all layers it is composed of. |
|
| 81 |
- // |
|
| 82 |
- // Required: true |
|
| 83 |
- Size int64 `json:"Size"` |
|
| 84 |
- |
|
| 85 |
- // Total size of the image including all layers it is composed of. |
|
| 86 |
- // |
|
| 87 |
- // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead. |
|
| 88 |
- VirtualSize int64 `json:"VirtualSize,omitempty"` |
|
| 89 |
-} |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types/container" |
| 9 | 9 |
"github.com/docker/docker/api/types/filters" |
| 10 |
+ "github.com/docker/docker/api/types/image" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/mount" |
| 11 | 12 |
"github.com/docker/docker/api/types/network" |
| 12 | 13 |
"github.com/docker/docker/api/types/swarm" |
| ... | ... |
@@ -128,13 +129,7 @@ type ImageInspect struct {
|
| 128 | 128 |
// Metadata of the image in the local cache. |
| 129 | 129 |
// |
| 130 | 130 |
// This information is local to the daemon, and not part of the image itself. |
| 131 |
- Metadata ImageMetadata |
|
| 132 |
-} |
|
| 133 |
- |
|
| 134 |
-// ImageMetadata contains engine-local data about the image |
|
| 135 |
-type ImageMetadata struct {
|
|
| 136 |
- // LastTagTime is the date and time at which the image was last tagged. |
|
| 137 |
- LastTagTime time.Time `json:",omitempty"` |
|
| 131 |
+ Metadata image.Metadata |
|
| 138 | 132 |
} |
| 139 | 133 |
|
| 140 | 134 |
// Container contains response of Engine API: |
| ... | ... |
@@ -514,7 +509,7 @@ type DiskUsageOptions struct {
|
| 514 | 514 |
// GET "/system/df" |
| 515 | 515 |
type DiskUsage struct {
|
| 516 | 516 |
LayersSize int64 |
| 517 |
- Images []*ImageSummary |
|
| 517 |
+ Images []*image.Summary |
|
| 518 | 518 |
Containers []*Container |
| 519 | 519 |
Volumes []*volume.Volume |
| 520 | 520 |
BuildCache []*BuildCache |
| ... | ... |
@@ -538,7 +533,7 @@ type VolumesPruneReport struct {
|
| 538 | 538 |
// ImagesPruneReport contains the response for Engine API: |
| 539 | 539 |
// POST "/images/prune" |
| 540 | 540 |
type ImagesPruneReport struct {
|
| 541 |
- ImagesDeleted []ImageDeleteResponseItem |
|
| 541 |
+ ImagesDeleted []image.DeleteResponse |
|
| 542 | 542 |
SpaceReclaimed uint64 |
| 543 | 543 |
} |
| 544 | 544 |
|
| ... | ... |
@@ -2,6 +2,7 @@ package types |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"github.com/docker/docker/api/types/checkpoint" |
| 5 |
+ "github.com/docker/docker/api/types/image" |
|
| 5 | 6 |
"github.com/docker/docker/api/types/system" |
| 6 | 7 |
) |
| 7 | 8 |
|
| ... | ... |
@@ -63,6 +64,21 @@ type SecurityOpt = system.SecurityOpt |
| 63 | 63 |
// Deprecated: use [system.KeyValue]. |
| 64 | 64 |
type KeyValue = system.KeyValue |
| 65 | 65 |
|
| 66 |
+// ImageDeleteResponseItem image delete response item. |
|
| 67 |
+// |
|
| 68 |
+// Deprecated: use [image.DeleteResponse]. |
|
| 69 |
+type ImageDeleteResponseItem = image.DeleteResponse |
|
| 70 |
+ |
|
| 71 |
+// ImageSummary image summary. |
|
| 72 |
+// |
|
| 73 |
+// Deprecated: use [image.Summary]. |
|
| 74 |
+type ImageSummary = image.Summary |
|
| 75 |
+ |
|
| 76 |
+// ImageMetadata contains engine-local data about the image. |
|
| 77 |
+// |
|
| 78 |
+// Deprecated: use [image.Metadata]. |
|
| 79 |
+type ImageMetadata = image.Metadata |
|
| 80 |
+ |
|
| 66 | 81 |
// DecodeSecurityOptions decodes a security options string slice to a type safe |
| 67 | 82 |
// [system.SecurityOpt]. |
| 68 | 83 |
// |
| ... | ... |
@@ -7,11 +7,12 @@ import ( |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 | 9 |
"github.com/docker/docker/api/types/filters" |
| 10 |
+ "github.com/docker/docker/api/types/image" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/versions" |
| 11 | 12 |
) |
| 12 | 13 |
|
| 13 | 14 |
// ImageList returns a list of images in the docker host. |
| 14 |
-func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {
|
|
| 15 |
+func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) {
|
|
| 15 | 16 |
// Make sure we negotiated (if the client is configured to do so), |
| 16 | 17 |
// as code below contains API-version specific handling of options. |
| 17 | 18 |
// |
| ... | ... |
@@ -19,7 +20,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions |
| 19 | 19 |
// the API request is made. |
| 20 | 20 |
cli.checkVersion(ctx) |
| 21 | 21 |
|
| 22 |
- var images []types.ImageSummary |
|
| 22 |
+ var images []image.Summary |
|
| 23 | 23 |
query := url.Values{}
|
| 24 | 24 |
|
| 25 | 25 |
optionFilters := options.Filters |
| ... | ... |
@@ -13,6 +13,7 @@ import ( |
| 13 | 13 |
|
| 14 | 14 |
"github.com/docker/docker/api/types" |
| 15 | 15 |
"github.com/docker/docker/api/types/filters" |
| 16 |
+ "github.com/docker/docker/api/types/image" |
|
| 16 | 17 |
"github.com/docker/docker/errdefs" |
| 17 | 18 |
"gotest.tools/v3/assert" |
| 18 | 19 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -80,7 +81,7 @@ func TestImageList(t *testing.T) {
|
| 80 | 80 |
return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
|
| 81 | 81 |
} |
| 82 | 82 |
} |
| 83 |
- content, err := json.Marshal([]types.ImageSummary{
|
|
| 83 |
+ content, err := json.Marshal([]image.Summary{
|
|
| 84 | 84 |
{
|
| 85 | 85 |
ID: "image_id2", |
| 86 | 86 |
}, |
| ... | ... |
@@ -121,7 +122,7 @@ func TestImageListApiBefore125(t *testing.T) {
|
| 121 | 121 |
if actualFilters != "" {
|
| 122 | 122 |
return nil, fmt.Errorf("filters should have not been present, were with value: %s", actualFilters)
|
| 123 | 123 |
} |
| 124 |
- content, err := json.Marshal([]types.ImageSummary{
|
|
| 124 |
+ content, err := json.Marshal([]image.Summary{
|
|
| 125 | 125 |
{
|
| 126 | 126 |
ID: "image_id2", |
| 127 | 127 |
}, |
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
"strings" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
+ "github.com/docker/docker/api/types/image" |
|
| 13 | 14 |
"github.com/docker/docker/errdefs" |
| 14 | 15 |
|
| 15 | 16 |
"github.com/docker/docker/api/types" |
| ... | ... |
@@ -84,7 +85,7 @@ func TestImagesPrune(t *testing.T) {
|
| 84 | 84 |
assert.Check(t, is.Equal(expected, actual)) |
| 85 | 85 |
} |
| 86 | 86 |
content, err := json.Marshal(types.ImagesPruneReport{
|
| 87 |
- ImagesDeleted: []types.ImageDeleteResponseItem{
|
|
| 87 |
+ ImagesDeleted: []image.DeleteResponse{
|
|
| 88 | 88 |
{
|
| 89 | 89 |
Deleted: "image_id1", |
| 90 | 90 |
}, |
| ... | ... |
@@ -6,10 +6,11 @@ import ( |
| 6 | 6 |
"net/url" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 |
+ "github.com/docker/docker/api/types/image" |
|
| 9 | 10 |
) |
| 10 | 11 |
|
| 11 | 12 |
// ImageRemove removes an image from the docker host. |
| 12 |
-func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
|
|
| 13 |
+func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
|
| 13 | 14 |
query := url.Values{}
|
| 14 | 15 |
|
| 15 | 16 |
if options.Force {
|
| ... | ... |
@@ -19,7 +20,7 @@ func (cli *Client) ImageRemove(ctx context.Context, imageID string, options type |
| 19 | 19 |
query.Set("noprune", "1")
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
- var dels []types.ImageDeleteResponseItem |
|
| 22 |
+ var dels []image.DeleteResponse |
|
| 23 | 23 |
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil) |
| 24 | 24 |
defer ensureReaderClosed(resp) |
| 25 | 25 |
if err != nil {
|
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 | 13 |
"github.com/docker/docker/api/types" |
| 14 |
+ "github.com/docker/docker/api/types/image" |
|
| 14 | 15 |
"github.com/docker/docker/errdefs" |
| 15 | 16 |
"gotest.tools/v3/assert" |
| 16 | 17 |
is "gotest.tools/v3/assert/cmp" |
| ... | ... |
@@ -74,7 +75,7 @@ func TestImageRemove(t *testing.T) {
|
| 74 | 74 |
return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
|
| 75 | 75 |
} |
| 76 | 76 |
} |
| 77 |
- b, err := json.Marshal([]types.ImageDeleteResponseItem{
|
|
| 77 |
+ b, err := json.Marshal([]image.DeleteResponse{
|
|
| 78 | 78 |
{
|
| 79 | 79 |
Untagged: "image_id1", |
| 80 | 80 |
}, |
| ... | ... |
@@ -94,11 +94,11 @@ type ImageAPIClient interface {
|
| 94 | 94 |
ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error) |
| 95 | 95 |
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) |
| 96 | 96 |
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error) |
| 97 |
- ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) |
|
| 97 |
+ ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) |
|
| 98 | 98 |
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) |
| 99 | 99 |
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) |
| 100 | 100 |
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error) |
| 101 |
- ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) |
|
| 101 |
+ ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) |
|
| 102 | 102 |
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error) |
| 103 | 103 |
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error) |
| 104 | 104 |
ImageTag(ctx context.Context, image, ref string) error |
| ... | ... |
@@ -9,8 +9,8 @@ import ( |
| 9 | 9 |
"github.com/containerd/containerd/images" |
| 10 | 10 |
"github.com/containerd/log" |
| 11 | 11 |
"github.com/distribution/reference" |
| 12 |
- "github.com/docker/docker/api/types" |
|
| 13 | 12 |
"github.com/docker/docker/api/types/events" |
| 13 |
+ imagetypes "github.com/docker/docker/api/types/image" |
|
| 14 | 14 |
"github.com/docker/docker/container" |
| 15 | 15 |
"github.com/docker/docker/image" |
| 16 | 16 |
"github.com/docker/docker/internal/compatcontext" |
| ... | ... |
@@ -52,7 +52,7 @@ import ( |
| 52 | 52 |
// conflict will not be reported. |
| 53 | 53 |
// |
| 54 | 54 |
// TODO(thaJeztah): image delete should send prometheus counters; see https://github.com/moby/moby/issues/45268 |
| 55 |
-func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
|
|
| 55 |
+func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
|
|
| 56 | 56 |
parsedRef, err := reference.ParseNormalizedNamed(imageRef) |
| 57 | 57 |
if err != nil {
|
| 58 | 58 |
return nil, err |
| ... | ... |
@@ -80,7 +80,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 80 | 80 |
return nil, err |
| 81 | 81 |
} |
| 82 | 82 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 83 |
- records := []types.ImageDeleteResponseItem{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
|
|
| 83 |
+ records := []imagetypes.DeleteResponse{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
|
|
| 84 | 84 |
return records, nil |
| 85 | 85 |
} |
| 86 | 86 |
|
| ... | ... |
@@ -111,7 +111,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 114 |
- records := []types.ImageDeleteResponseItem{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
|
|
| 114 |
+ records := []imagetypes.DeleteResponse{{Untagged: reference.FamiliarString(reference.TagNameOnly(parsedRef))}}
|
|
| 115 | 115 |
return records, nil |
| 116 | 116 |
} |
| 117 | 117 |
|
| ... | ... |
@@ -122,8 +122,8 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 122 | 122 |
// also deletes dangling parents if there is no conflict in doing so. |
| 123 | 123 |
// Parent images are removed quietly, and if there is any issue/conflict |
| 124 | 124 |
// it is logged but does not halt execution/an error is not returned. |
| 125 |
-func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
|
|
| 126 |
- var records []types.ImageDeleteResponseItem |
|
| 125 |
+func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, prune bool) ([]imagetypes.DeleteResponse, error) {
|
|
| 126 |
+ var records []imagetypes.DeleteResponse |
|
| 127 | 127 |
|
| 128 | 128 |
// Workaround for: https://github.com/moby/buildkit/issues/3797 |
| 129 | 129 |
possiblyDeletedConfigs := map[digest.Digest]struct{}{}
|
| ... | ... |
@@ -163,7 +163,7 @@ func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, p |
| 163 | 163 |
} |
| 164 | 164 |
} |
| 165 | 165 |
i.LogImageEvent(imgID, imgID, events.ActionDelete) |
| 166 |
- records = append(records, types.ImageDeleteResponseItem{Deleted: imgID})
|
|
| 166 |
+ records = append(records, imagetypes.DeleteResponse{Deleted: imgID})
|
|
| 167 | 167 |
|
| 168 | 168 |
for _, parent := range parents {
|
| 169 | 169 |
if !isDanglingImage(parent.img) {
|
| ... | ... |
@@ -176,7 +176,7 @@ func (i *ImageService) deleteAll(ctx context.Context, img images.Image, force, p |
| 176 | 176 |
} |
| 177 | 177 |
parentID := parent.img.Target.Digest.String() |
| 178 | 178 |
i.LogImageEvent(parentID, parentID, events.ActionDelete) |
| 179 |
- records = append(records, types.ImageDeleteResponseItem{Deleted: parentID})
|
|
| 179 |
+ records = append(records, imagetypes.DeleteResponse{Deleted: parentID})
|
|
| 180 | 180 |
} |
| 181 | 181 |
|
| 182 | 182 |
return records, nil |
| ... | ... |
@@ -238,7 +238,7 @@ const ( |
| 238 | 238 |
// images and untagged references are appended to the given records. If any |
| 239 | 239 |
// error or conflict is encountered, it will be returned immediately without |
| 240 | 240 |
// deleting the image. |
| 241 |
-func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image, records *[]types.ImageDeleteResponseItem, force bool) error {
|
|
| 241 |
+func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image, records *[]imagetypes.DeleteResponse, force bool) error {
|
|
| 242 | 242 |
// First, determine if this image has any conflicts. Ignore soft conflicts |
| 243 | 243 |
// if force is true. |
| 244 | 244 |
c := conflictHard |
| ... | ... |
@@ -264,7 +264,7 @@ func (i *ImageService) imageDeleteHelper(ctx context.Context, img images.Image, |
| 264 | 264 |
|
| 265 | 265 |
if !isDanglingImage(img) {
|
| 266 | 266 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 267 |
- *records = append(*records, types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(untaggedRef)})
|
|
| 267 |
+ *records = append(*records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(untaggedRef)})
|
|
| 268 | 268 |
} |
| 269 | 269 |
|
| 270 | 270 |
return nil |
| ... | ... |
@@ -46,7 +46,7 @@ var acceptedImageFilterTags = map[string]bool{
|
| 46 | 46 |
|
| 47 | 47 |
// byCreated is a temporary type used to sort a list of images by creation |
| 48 | 48 |
// time. |
| 49 |
-type byCreated []*types.ImageSummary |
|
| 49 |
+type byCreated []*imagetypes.Summary |
|
| 50 | 50 |
|
| 51 | 51 |
func (r byCreated) Len() int { return len(r) }
|
| 52 | 52 |
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 }
|
| 57 | 57 |
// TODO(thaJeztah): implement opts.ContainerCount (used for docker system df); see https://github.com/moby/moby/issues/43853 |
| 58 | 58 |
// TODO(thaJeztah): verify behavior of `RepoDigests` and `RepoTags` for images without (untagged) or multiple tags; see https://github.com/moby/moby/issues/43861 |
| 59 | 59 |
// TODO(thaJeztah): verify "Size" vs "VirtualSize" in images; see https://github.com/moby/moby/issues/43862 |
| 60 |
-func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
|
|
| 60 |
+func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetypes.Summary, error) {
|
|
| 61 | 61 |
if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
|
| 62 | 62 |
return nil, err |
| 63 | 63 |
} |
| ... | ... |
@@ -89,7 +89,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) |
| 89 | 89 |
|
| 90 | 90 |
var ( |
| 91 | 91 |
allContainers []*container.Container |
| 92 |
- summaries = make([]*types.ImageSummary, 0, len(imgs)) |
|
| 92 |
+ summaries = make([]*imagetypes.Summary, 0, len(imgs)) |
|
| 93 | 93 |
root []*[]digest.Digest |
| 94 | 94 |
layers map[digest.Digest]int |
| 95 | 95 |
) |
| ... | ... |
@@ -208,7 +208,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) |
| 208 | 208 |
return summaries, nil |
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 |
-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) {
|
|
| 211 |
+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) {
|
|
| 212 | 212 |
diffIDs, err := imageManifest.RootFS(ctx) |
| 213 | 213 |
if err != nil {
|
| 214 | 214 |
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 |
| 276 | 276 |
return nil, nil, err |
| 277 | 277 |
} |
| 278 | 278 |
|
| 279 |
- summary := &types.ImageSummary{
|
|
| 279 |
+ summary := &imagetypes.Summary{
|
|
| 280 | 280 |
ParentID: "", |
| 281 | 281 |
ID: target.String(), |
| 282 | 282 |
Created: rawImg.CreatedAt.Unix(), |
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
"github.com/distribution/reference" |
| 11 | 11 |
"github.com/docker/docker/api/types" |
| 12 | 12 |
"github.com/docker/docker/api/types/filters" |
| 13 |
+ "github.com/docker/docker/api/types/image" |
|
| 13 | 14 |
"github.com/docker/docker/errdefs" |
| 14 | 15 |
"github.com/docker/docker/internal/compatcontext" |
| 15 | 16 |
"github.com/hashicorp/go-multierror" |
| ... | ... |
@@ -182,7 +183,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu |
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 | 184 |
report.ImagesDeleted = append(report.ImagesDeleted, |
| 185 |
- types.ImageDeleteResponseItem{
|
|
| 185 |
+ image.DeleteResponse{
|
|
| 186 | 186 |
Untagged: img.Name, |
| 187 | 187 |
}, |
| 188 | 188 |
) |
| ... | ... |
@@ -193,7 +194,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu |
| 193 | 193 |
|
| 194 | 194 |
if cerrdefs.IsNotFound(err) {
|
| 195 | 195 |
report.ImagesDeleted = append(report.ImagesDeleted, |
| 196 |
- types.ImageDeleteResponseItem{
|
|
| 196 |
+ image.DeleteResponse{
|
|
| 197 | 197 |
Deleted: blob.Digest.String(), |
| 198 | 198 |
}, |
| 199 | 199 |
) |
| ... | ... |
@@ -27,6 +27,7 @@ import ( |
| 27 | 27 |
dist "github.com/docker/distribution" |
| 28 | 28 |
"github.com/docker/docker/api/types" |
| 29 | 29 |
containertypes "github.com/docker/docker/api/types/container" |
| 30 |
+ imagetypes "github.com/docker/docker/api/types/image" |
|
| 30 | 31 |
registrytypes "github.com/docker/docker/api/types/registry" |
| 31 | 32 |
"github.com/docker/docker/api/types/swarm" |
| 32 | 33 |
"github.com/docker/docker/api/types/volume" |
| ... | ... |
@@ -122,7 +123,7 @@ type Daemon struct {
|
| 122 | 122 |
seccompProfilePath string |
| 123 | 123 |
|
| 124 | 124 |
usageContainers singleflight.Group[struct{}, []*types.Container]
|
| 125 |
- usageImages singleflight.Group[struct{}, []*types.ImageSummary]
|
|
| 125 |
+ usageImages singleflight.Group[struct{}, []*imagetypes.Summary]
|
|
| 126 | 126 |
usageVolumes singleflight.Group[struct{}, []*volume.Volume]
|
| 127 | 127 |
usageLayer singleflight.Group[struct{}, int64]
|
| 128 | 128 |
|
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"github.com/docker/docker/api/server/router/system" |
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 | 9 |
"github.com/docker/docker/api/types/filters" |
| 10 |
+ "github.com/docker/docker/api/types/image" |
|
| 10 | 11 |
"github.com/docker/docker/api/types/volume" |
| 11 | 12 |
"github.com/pkg/errors" |
| 12 | 13 |
"golang.org/x/sync/errgroup" |
| ... | ... |
@@ -31,8 +32,8 @@ func (daemon *Daemon) containerDiskUsage(ctx context.Context) ([]*types.Containe |
| 31 | 31 |
|
| 32 | 32 |
// imageDiskUsage obtains information about image data disk usage from image service |
| 33 | 33 |
// and makes sure that only one calculation is performed at the same time. |
| 34 |
-func (daemon *Daemon) imageDiskUsage(ctx context.Context) ([]*types.ImageSummary, error) {
|
|
| 35 |
- imgs, _, err := daemon.usageImages.Do(ctx, struct{}{}, func(ctx context.Context) ([]*types.ImageSummary, error) {
|
|
| 34 |
+func (daemon *Daemon) imageDiskUsage(ctx context.Context) ([]*image.Summary, error) {
|
|
| 35 |
+ imgs, _, err := daemon.usageImages.Do(ctx, struct{}{}, func(ctx context.Context) ([]*image.Summary, error) {
|
|
| 36 | 36 |
// Get all top images with extra attributes |
| 37 | 37 |
imgs, err := daemon.imageService.Images(ctx, types.ImageListOptions{
|
| 38 | 38 |
Filters: filters.NewArgs(), |
| ... | ... |
@@ -89,7 +90,7 @@ func (daemon *Daemon) SystemDiskUsage(ctx context.Context, opts system.DiskUsage |
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
var ( |
| 92 |
- images []*types.ImageSummary |
|
| 92 |
+ images []*image.Summary |
|
| 93 | 93 |
layersSize int64 |
| 94 | 94 |
) |
| 95 | 95 |
if opts.Images {
|
| ... | ... |
@@ -30,11 +30,11 @@ type ImageService interface {
|
| 30 | 30 |
PullImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error |
| 31 | 31 |
PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error |
| 32 | 32 |
CreateImage(ctx context.Context, config []byte, parent string, contentStoreDigest digest.Digest) (builder.Image, error) |
| 33 |
- ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) |
|
| 33 |
+ ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetype.DeleteResponse, error) |
|
| 34 | 34 |
ExportImage(ctx context.Context, names []string, outStream io.Writer) error |
| 35 | 35 |
PerformWithBaseFS(ctx context.Context, c *container.Container, fn func(string) error) error |
| 36 | 36 |
LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error |
| 37 |
- Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) |
|
| 37 |
+ Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetype.Summary, error) |
|
| 38 | 38 |
LogImageEvent(imageID, refName string, action events.Action) |
| 39 | 39 |
CountImages() int |
| 40 | 40 |
ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/distribution/reference" |
| 10 |
- "github.com/docker/docker/api/types" |
|
| 11 | 10 |
"github.com/docker/docker/api/types/events" |
| 12 | 11 |
imagetypes "github.com/docker/docker/api/types/image" |
| 13 | 12 |
"github.com/docker/docker/container" |
| ... | ... |
@@ -61,9 +60,9 @@ const ( |
| 61 | 61 |
// If prune is true, ancestor images will each attempt to be deleted quietly, |
| 62 | 62 |
// meaning any delete conflicts will cause the image to not be deleted and the |
| 63 | 63 |
// conflict will not be reported. |
| 64 |
-func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error) {
|
|
| 64 |
+func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
|
|
| 65 | 65 |
start := time.Now() |
| 66 |
- records := []types.ImageDeleteResponseItem{}
|
|
| 66 |
+ records := []imagetypes.DeleteResponse{}
|
|
| 67 | 67 |
|
| 68 | 68 |
img, err := i.GetImage(ctx, imageRef, imagetypes.GetImageOpts{})
|
| 69 | 69 |
if err != nil {
|
| ... | ... |
@@ -104,7 +103,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 104 | 104 |
return nil, err |
| 105 | 105 |
} |
| 106 | 106 |
|
| 107 |
- untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(parsedRef)}
|
|
| 107 |
+ untaggedRecord := imagetypes.DeleteResponse{Untagged: reference.FamiliarString(parsedRef)}
|
|
| 108 | 108 |
|
| 109 | 109 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 110 | 110 |
records = append(records, untaggedRecord) |
| ... | ... |
@@ -130,9 +129,7 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 130 | 130 |
if _, err := i.removeImageRef(repoRef); err != nil {
|
| 131 | 131 |
return records, err |
| 132 | 132 |
} |
| 133 |
- |
|
| 134 |
- untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(repoRef)}
|
|
| 135 |
- records = append(records, untaggedRecord) |
|
| 133 |
+ records = append(records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(repoRef)})
|
|
| 136 | 134 |
} else {
|
| 137 | 135 |
remainingRefs = append(remainingRefs, repoRef) |
| 138 | 136 |
} |
| ... | ... |
@@ -165,11 +162,8 @@ func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, |
| 165 | 165 |
if err != nil {
|
| 166 | 166 |
return nil, err |
| 167 | 167 |
} |
| 168 |
- |
|
| 169 |
- untaggedRecord := types.ImageDeleteResponseItem{Untagged: reference.FamiliarString(parsedRef)}
|
|
| 170 |
- |
|
| 171 | 168 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 172 |
- records = append(records, untaggedRecord) |
|
| 169 |
+ records = append(records, imagetypes.DeleteResponse{Untagged: reference.FamiliarString(parsedRef)})
|
|
| 173 | 170 |
} |
| 174 | 171 |
} |
| 175 | 172 |
} |
| ... | ... |
@@ -243,14 +237,14 @@ func (i *ImageService) removeImageRef(ref reference.Named) (reference.Named, err |
| 243 | 243 |
// on the first encountered error. Removed references are logged to this |
| 244 | 244 |
// daemon's event service. An "Untagged" types.ImageDeleteResponseItem is added to the |
| 245 | 245 |
// given list of records. |
| 246 |
-func (i *ImageService) removeAllReferencesToImageID(imgID image.ID, records *[]types.ImageDeleteResponseItem) error {
|
|
| 246 |
+func (i *ImageService) removeAllReferencesToImageID(imgID image.ID, records *[]imagetypes.DeleteResponse) error {
|
|
| 247 | 247 |
for _, imageRef := range i.referenceStore.References(imgID.Digest()) {
|
| 248 | 248 |
parsedRef, err := i.removeImageRef(imageRef) |
| 249 | 249 |
if err != nil {
|
| 250 | 250 |
return err |
| 251 | 251 |
} |
| 252 | 252 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionUnTag) |
| 253 |
- *records = append(*records, types.ImageDeleteResponseItem{
|
|
| 253 |
+ *records = append(*records, imagetypes.DeleteResponse{
|
|
| 254 | 254 |
Untagged: reference.FamiliarString(parsedRef), |
| 255 | 255 |
}) |
| 256 | 256 |
} |
| ... | ... |
@@ -291,7 +285,7 @@ func (idc *imageDeleteConflict) Conflict() {}
|
| 291 | 291 |
// conflict is encountered, it will be returned immediately without deleting |
| 292 | 292 |
// the image. If quiet is true, any encountered conflicts will be ignored and |
| 293 | 293 |
// the function will return nil immediately without deleting the image. |
| 294 |
-func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]types.ImageDeleteResponseItem, force, prune, quiet bool) error {
|
|
| 294 |
+func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]imagetypes.DeleteResponse, force, prune, quiet bool) error {
|
|
| 295 | 295 |
// First, determine if this image has any conflicts. Ignore soft conflicts |
| 296 | 296 |
// if force is true. |
| 297 | 297 |
c := conflictHard |
| ... | ... |
@@ -327,9 +321,9 @@ func (i *ImageService) imageDeleteHelper(imgID image.ID, records *[]types.ImageD |
| 327 | 327 |
} |
| 328 | 328 |
|
| 329 | 329 |
i.LogImageEvent(imgID.String(), imgID.String(), events.ActionDelete) |
| 330 |
- *records = append(*records, types.ImageDeleteResponseItem{Deleted: imgID.String()})
|
|
| 330 |
+ *records = append(*records, imagetypes.DeleteResponse{Deleted: imgID.String()})
|
|
| 331 | 331 |
for _, removedLayer := range removedLayers {
|
| 332 |
- *records = append(*records, types.ImageDeleteResponseItem{Deleted: removedLayer.ChainID.String()})
|
|
| 332 |
+ *records = append(*records, imagetypes.DeleteResponse{Deleted: removedLayer.ChainID.String()})
|
|
| 333 | 333 |
} |
| 334 | 334 |
|
| 335 | 335 |
if !prune || parent == "" {
|
| ... | ... |
@@ -25,14 +25,14 @@ var acceptedImageFilterTags = map[string]bool{
|
| 25 | 25 |
|
| 26 | 26 |
// byCreated is a temporary type used to sort a list of images by creation |
| 27 | 27 |
// time. |
| 28 |
-type byCreated []*types.ImageSummary |
|
| 28 |
+type byCreated []*imagetypes.Summary |
|
| 29 | 29 |
|
| 30 | 30 |
func (r byCreated) Len() int { return len(r) }
|
| 31 | 31 |
func (r byCreated) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
|
| 32 | 32 |
func (r byCreated) Less(i, j int) bool { return r[i].Created < r[j].Created }
|
| 33 | 33 |
|
| 34 | 34 |
// Images returns a filtered list of images. |
| 35 |
-func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*types.ImageSummary, error) {
|
|
| 35 |
+func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) ([]*imagetypes.Summary, error) {
|
|
| 36 | 36 |
if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
|
| 37 | 37 |
return nil, err |
| 38 | 38 |
} |
| ... | ... |
@@ -83,8 +83,8 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
var ( |
| 86 |
- summaries = make([]*types.ImageSummary, 0, len(selectedImages)) |
|
| 87 |
- summaryMap map[*image.Image]*types.ImageSummary |
|
| 86 |
+ summaries = make([]*imagetypes.Summary, 0, len(selectedImages)) |
|
| 87 |
+ summaryMap map[*image.Image]*imagetypes.Summary |
|
| 88 | 88 |
allContainers []*container.Container |
| 89 | 89 |
) |
| 90 | 90 |
for id, img := range selectedImages {
|
| ... | ... |
@@ -197,7 +197,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) |
| 197 | 197 |
if opts.ContainerCount || opts.SharedSize {
|
| 198 | 198 |
// Lazily init summaryMap. |
| 199 | 199 |
if summaryMap == nil {
|
| 200 |
- summaryMap = make(map[*image.Image]*types.ImageSummary, len(selectedImages)) |
|
| 200 |
+ summaryMap = make(map[*image.Image]*imagetypes.Summary, len(selectedImages)) |
|
| 201 | 201 |
} |
| 202 | 202 |
summaryMap[img] = summary |
| 203 | 203 |
} |
| ... | ... |
@@ -252,12 +252,12 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) |
| 252 | 252 |
return summaries, nil |
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 |
-func newImageSummary(image *image.Image, size int64) *types.ImageSummary {
|
|
| 255 |
+func newImageSummary(image *image.Image, size int64) *imagetypes.Summary {
|
|
| 256 | 256 |
var created int64 |
| 257 | 257 |
if image.Created != nil {
|
| 258 | 258 |
created = image.Created.Unix() |
| 259 | 259 |
} |
| 260 |
- summary := &types.ImageSummary{
|
|
| 260 |
+ summary := &imagetypes.Summary{
|
|
| 261 | 261 |
ParentID: image.Parent.String(), |
| 262 | 262 |
ID: image.ID().String(), |
| 263 | 263 |
Created: created, |
| ... | ... |
@@ -12,6 +12,7 @@ import ( |
| 12 | 12 |
"github.com/docker/docker/api/types" |
| 13 | 13 |
"github.com/docker/docker/api/types/events" |
| 14 | 14 |
"github.com/docker/docker/api/types/filters" |
| 15 |
+ imagetypes "github.com/docker/docker/api/types/image" |
|
| 15 | 16 |
timetypes "github.com/docker/docker/api/types/time" |
| 16 | 17 |
"github.com/docker/docker/errdefs" |
| 17 | 18 |
"github.com/docker/docker/image" |
| ... | ... |
@@ -96,7 +97,7 @@ deleteImagesLoop: |
| 96 | 96 |
default: |
| 97 | 97 |
} |
| 98 | 98 |
|
| 99 |
- deletedImages := []types.ImageDeleteResponseItem{}
|
|
| 99 |
+ deletedImages := []imagetypes.DeleteResponse{}
|
|
| 100 | 100 |
refs := i.referenceStore.References(id.Digest()) |
| 101 | 101 |
if len(refs) > 0 {
|
| 102 | 102 |
shouldDelete := !danglingOnly |
| ... | ... |
@@ -6,8 +6,6 @@ swagger generate model -f api/swagger.yaml \ |
| 6 | 6 |
-n ErrorResponse \ |
| 7 | 7 |
-n GraphDriverData \ |
| 8 | 8 |
-n IdResponse \ |
| 9 |
- -n ImageDeleteResponseItem \ |
|
| 10 |
- -n ImageSummary \ |
|
| 11 | 9 |
-n Plugin \ |
| 12 | 10 |
-n PluginDevice \ |
| 13 | 11 |
-n PluginMount \ |
| ... | ... |
@@ -25,6 +23,11 @@ swagger generate model -f api/swagger.yaml \ |
| 25 | 25 |
-n FilesystemChange |
| 26 | 26 |
|
| 27 | 27 |
swagger generate model -f api/swagger.yaml \ |
| 28 |
+ -t api -m types/image --skip-validator -C api/swagger-gen.yaml \ |
|
| 29 |
+ -n ImageDeleteResponseItem \ |
|
| 30 |
+ -n ImageSummary |
|
| 31 |
+ |
|
| 32 |
+swagger generate model -f api/swagger.yaml \ |
|
| 28 | 33 |
-t api -m types/volume --skip-validator -C api/swagger-gen.yaml \ |
| 29 | 34 |
-n Volume \ |
| 30 | 35 |
-n VolumeCreateOptions \ |
| ... | ... |
@@ -4,6 +4,7 @@ import ( |
| 4 | 4 |
"testing" |
| 5 | 5 |
|
| 6 | 6 |
"github.com/docker/docker/api/types" |
| 7 |
+ "github.com/docker/docker/api/types/image" |
|
| 7 | 8 |
"github.com/docker/docker/api/types/volume" |
| 8 | 9 |
"github.com/docker/docker/integration/internal/container" |
| 9 | 10 |
"github.com/docker/docker/testutil" |
| ... | ... |
@@ -36,7 +37,7 @@ func TestDiskUsage(t *testing.T) {
|
| 36 | 36 |
du, err := client.DiskUsage(ctx, types.DiskUsageOptions{})
|
| 37 | 37 |
assert.NilError(t, err) |
| 38 | 38 |
assert.DeepEqual(t, du, types.DiskUsage{
|
| 39 |
- Images: []*types.ImageSummary{},
|
|
| 39 |
+ Images: []*image.Summary{},
|
|
| 40 | 40 |
Containers: []*types.Container{},
|
| 41 | 41 |
Volumes: []*volume.Volume{},
|
| 42 | 42 |
BuildCache: []*types.BuildCache{},
|
| ... | ... |
@@ -55,7 +56,7 @@ func TestDiskUsage(t *testing.T) {
|
| 55 | 55 |
assert.Equal(t, len(du.Images), 1) |
| 56 | 56 |
assert.DeepEqual(t, du, types.DiskUsage{
|
| 57 | 57 |
LayersSize: du.LayersSize, |
| 58 |
- Images: []*types.ImageSummary{
|
|
| 58 |
+ Images: []*image.Summary{
|
|
| 59 | 59 |
{
|
| 60 | 60 |
Created: du.Images[0].Created, |
| 61 | 61 |
ID: du.Images[0].ID, |
| ... | ... |
@@ -83,8 +84,8 @@ func TestDiskUsage(t *testing.T) {
|
| 83 | 83 |
assert.Assert(t, du.Containers[0].Created >= prev.Images[0].Created) |
| 84 | 84 |
assert.DeepEqual(t, du, types.DiskUsage{
|
| 85 | 85 |
LayersSize: prev.LayersSize, |
| 86 |
- Images: []*types.ImageSummary{
|
|
| 87 |
- func() *types.ImageSummary {
|
|
| 86 |
+ Images: []*image.Summary{
|
|
| 87 |
+ func() *image.Summary {
|
|
| 88 | 88 |
sum := *prev.Images[0] |
| 89 | 89 |
sum.Containers++ |
| 90 | 90 |
return &sum |
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types" |
| 8 | 8 |
"github.com/docker/docker/api/types/filters" |
| 9 |
+ "github.com/docker/docker/api/types/image" |
|
| 9 | 10 |
"github.com/docker/docker/api/types/volume" |
| 10 | 11 |
"github.com/docker/docker/errdefs" |
| 11 | 12 |
"go.opentelemetry.io/otel" |
| ... | ... |
@@ -112,13 +113,13 @@ func getExistingImages(ctx context.Context, t testing.TB, testEnv *Execution) [] |
| 112 | 112 |
assert.NilError(t, err, "failed to list images") |
| 113 | 113 |
|
| 114 | 114 |
var images []string |
| 115 |
- for _, image := range imageList {
|
|
| 116 |
- images = append(images, tagsFromImageSummary(image)...) |
|
| 115 |
+ for _, img := range imageList {
|
|
| 116 |
+ images = append(images, tagsFromImageSummary(img)...) |
|
| 117 | 117 |
} |
| 118 | 118 |
return images |
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 |
-func tagsFromImageSummary(image types.ImageSummary) []string {
|
|
| 121 |
+func tagsFromImageSummary(image image.Summary) []string {
|
|
| 122 | 122 |
var result []string |
| 123 | 123 |
for _, tag := range image.RepoTags {
|
| 124 | 124 |
// Starting from API 1.43 no longer outputs the hardcoded <none> |