Skip to content

Commit

Permalink
Merge pull request #47430 from vvoland/inspect-remove-container
Browse files Browse the repository at this point in the history
api/image-inspect: Remove Container and ContainerConfig
  • Loading branch information
thaJeztah committed Mar 14, 2024
2 parents 40c6813 + 0d5ef43 commit cdf70c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions api/server/router/image/image_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite
imageInspect.Created = time.Time{}.Format(time.RFC3339Nano)
}
}
if versions.GreaterThanOrEqualTo(version, "1.45") {
imageInspect.Container = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
imageInspect.ContainerConfig = nil //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.45.
}
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
}

Expand Down
4 changes: 2 additions & 2 deletions api/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type ImageInspect struct {
// Depending on how the image was created, this field may be empty.
//
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
Container string
Container string `json:",omitempty"`

// ContainerConfig is an optional field containing the configuration of the
// container that was last committed when creating the image.
Expand All @@ -91,7 +91,7 @@ type ImageInspect struct {
// and it is not in active use anymore.
//
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
ContainerConfig *container.Config
ContainerConfig *container.Config `json:",omitempty"`

// DockerVersion is the version of Docker that was used to build the image.
//
Expand Down
3 changes: 3 additions & 0 deletions docs/api/version-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ keywords: "API, Docker, rcli, REST, documentation"
* `POST /images/search` will always assume a `false` value for the `is-automated`
field. Consequently, searching for `is-automated=true` will yield no results,
while `is-automated=false` will be a no-op.
* `GET /images/{name}/json` no longer includes the `Container` and
`ContainerConfig` fields. To access image configuration, use `Config` field
instead.

## v1.44 API changes

Expand Down
8 changes: 4 additions & 4 deletions hack/make/test-docker-py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ source hack/make/.integration-test-helpers
# build --squash is not supported with containerd integration.
if [ -n "$TEST_INTEGRATION_USE_SNAPSHOTTER" ]; then
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_build_test.py::BuildTest::test_build_squash"

# TODO(vvoland): re-enable after https://github.com/docker/docker-py/pull/3203 is merged and in a tagged release.
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit"
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit_with_changes"
fi

# TODO(vvoland): re-enable after https://github.com/docker/docker-py/pull/3203 is included in the DOCKER_PY_COMMIT release.
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit"
PY_TEST_OPTIONS="$PY_TEST_OPTIONS --deselect=tests/integration/api_image_test.py::CommitTest::test_commit_with_changes"
(
bundle .integration-daemon-start

Expand Down

0 comments on commit cdf70c0

Please sign in to comment.