Skip to content

api: swagger: document "platform" param for GET /image/{name}/json#52082

Merged
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:inspect_platform
Feb 24, 2026
Merged

api: swagger: document "platform" param for GET /image/{name}/json#52082
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:inspect_platform

Conversation

@thaJeztah
Copy link
Member

api: swagger: document "platform" param for GET /image/{name}/json

This parameter was added in 59169d0
(API v1.49, docker 28.5.1), but forgot to update the swagger definition.

api/docs: add "platform" param for GET /image/{name}/json (API v1.49-v1.53)

This parameter was added in 59169d0
(API v1.49, docker 28.5.1), but forgot to update the swagger definition.

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

This parameter was added in 59169d0
(API v1.49, docker 28.5.1), but forgot to update the swagger definition.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
…9-v1.53)

This parameter was added in 59169d0
(API v1.49, docker 28.5.1), but forgot to update the swagger definition.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Comment on lines +9752 to +9759
JSON-encoded OCI platform to select the platform-variant.
If omitted, it defaults to any locally available platform,
prioritizing the daemon's host platform.

If the daemon provides a multi-platform image store, this selects
the platform-variant to show inspect. If the image is
a single-platform image, or if the multi-platform image does not
provide a variant matching the given platform, an error is returned.
Copy link
Member Author

@thaJeztah thaJeztah Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW (I used the same description as for history) it looks like we don't produce an error if the image variant is not present; I think that's a bug;

Trying this on an image that doesn't have the s390x variant present;

curl -s --unix-socket /var/run/docker.sock \
  --get 'http://localhost/v1.51/images/hello-world/json' \
  --data-urlencode 'manifests=0' \
  --data-urlencode 'platform={"os":"linux","architecture":"s390x"}' \
| jq .

Does not produce an error, but shows the image config fields with their default (zero) values;

{
  "Architecture": "",
  "Author": "",
  "Comment": "",
  "Config": {
    "Cmd": null,
    "Entrypoint": null,
    "Env": null,
    "Labels": null,
    "OnBuild": null,
    "User": "",
    "Volumes": null,
    "WorkingDir": ""
  },
  "Descriptor": {
    "annotations": {
      "com.docker.official-images.bashbrew.arch": "s390x",
      "org.opencontainers.image.base.name": "scratch",
      "org.opencontainers.image.created": "2025-08-14T02:53:30Z",
      "org.opencontainers.image.revision": "6930d60e10e81283a57be3ee3a2b5ca328a40304",
      "org.opencontainers.image.source": "https://github.com/docker-library/hello-world.git#6930d60e10e81283a57be3ee3a2b5ca328a40304:s390x/hello-world",
      "org.opencontainers.image.url": "https://hub.docker.com/_/hello-world",
      "org.opencontainers.image.version": "linux"
    },
    "digest": "sha256:92867137e934e6df211d16db0011244d3b30fc052caae4f09438f5f2134b7998",
    "mediaType": "application/vnd.oci.image.manifest.v1+json",
    "platform": {
      "architecture": "s390x",
      "os": "linux"
    },
    "size": 1035
  },
  "DockerVersion": "",
  "GraphDriver": {
    "Data": null,
    "Name": "overlayfs"
  },
  "Id": "sha256:92867137e934e6df211d16db0011244d3b30fc052caae4f09438f5f2134b7998",
  "Metadata": {
    "LastTagTime": "2026-02-23T09:04:09.165007301Z"
  },
  "Os": "",
  "Parent": "",
  "RepoDigests": [
    "hello-world@sha256:ef54e839ef541993b4e87f25e752f7cf4238fa55f017957c2eb44077083d7a6a"
  ],
  "RepoTags": [
    "hello-world:latest"
  ],
  "RootFS": {},
  "Size": 13377
}

When using graph-drivers, we DO produce an error, so I think it may be a bug in our logic;

curl -s --unix-socket /var/run/docker.sock \
  --get 'http://localhost/v1.51/images/hello-world/json' \
  --data-urlencode 'manifests=0' \
  --data-urlencode 'platform={"os":"linux","architecture":"s390x"}' \
| jq .
{
  "message": "image with reference hello-world was found but its platform (linux/arm64/v8) does not match the specified platform (linux/amd64)"
}

Comment on lines +9761 to +9762
The `platform` and `manifests` options are mutually exclusive, and
an error is produced if both are set.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combining with manifests=1 produces an error (as currently expected);

curl -s --unix-socket /var/run/docker.sock \
  --get 'http://localhost/v1.51/images/hello-world/json' \
  --data-urlencode 'manifests=1' \
  --data-urlencode 'platform={"os":"linux","architecture":"s390x"}' \
| jq .
{
  "message": "conflicting options: manifests and platform options cannot both be set"
}

@thaJeztah thaJeztah requested a review from vvoland February 23, 2026 13:23
@thaJeztah
Copy link
Member Author

I'll bring this one in; I may be opening a tracking ticket for the error case; I think it's a bug that it doesn't error if I request a specific platform and it's not present.

@thaJeztah thaJeztah merged commit afdae69 into moby:master Feb 24, 2026
367 of 371 checks passed
@thaJeztah thaJeztah deleted the inspect_platform branch February 24, 2026 16:33
@vvoland vvoland modified the milestones: 29.2.2, 29.3.0 Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspect API: platform query parameter not documented

3 participants