API: add Platform (OS and Architecture) to /containers/json#49407
API: add Platform (OS and Architecture) to /containers/json#49407thaJeztah merged 1 commit intomoby:masterfrom
Conversation
|
Ah, right, I need to refresh my memory as I recall there was some back and forth on doing this and I think some considered that it was part of the image info, but it's a long time since I worked on #42464 |
|
(i.e. ISTR there was some suggestion to include the image descriptor in the response or something along those lines ... but I need to dig really deep in memory 🤣) |
|
I did need to update the original PR a bit, but it was fewer code changes rather than more. The daemon didn't require any change because the platform had been added as a parameter at some point so it was already present. |
|
@vvoland I'd say yes, but the |
|
Yes, so that would actually solve that issue. If we exposed the whole image manifest descriptor like we did in container inspect: moby/api/types/container/container.go Lines 175 to 176 in 44ed306 the platform would also be a part of that descriptor: |
c1ae171 to
626a3f0
Compare
| if versions.LessThan(version, "1.48") { | ||
| // ImageManifestDescriptor information was added in API 1.48 | ||
| for _, c := range systemDiskUsage.Containers { | ||
| c.ImageManifestDescriptor = nil | ||
| } | ||
| } |
There was a problem hiding this comment.
Wondering if we should include that in the system disk usage at all 🤔
There was a problem hiding this comment.
Good point. ISTR that one was the horrible type that was reused "for convenience", but keeps popping up?
api/types/container/container.go
Outdated
| Names []string | ||
| Image string | ||
| ImageID string | ||
| ImageManifestDescriptor *ocispec.Descriptor `json:",omitempty"` |
There was a problem hiding this comment.
oh! Before I blame myself; we've been very lax on specifying the intended casing of fields in JSON (depending on "whatever Go makes of it); this has resulted in inconsistencies where the Swagger documented the wrong casing (the Id one is a good example of that, where we had to later adjust the case to what it happened to be). Go itself treats JSON case-insensitive, but not all languages do (and ISTR Go is working on a "v2" JSON package to allow case-sensitivity).
Probably good to add an explicit json:"ImageManifestDescriptor,omitempty" (at least for new fields; we should also tackle existing fields at some point)
28dcca1 to
921ed17
Compare
Adds platform information to containers (for `docker ps`). Signed-off-by: Jonathan A. Sternberg <[email protected]>
921ed17 to
927e07e
Compare
|
I've updated the test to only run when a multi-platform store is in use. I copied this from |
| snapshot.NetworkSettings = &container.NetworkSettingsSummary{Networks: networks} | ||
|
|
||
| if ctr.ImageManifest != nil && ctr.ImageManifest.Platform == nil { | ||
| ctr.ImageManifest.Platform = &ctr.ImagePlatform |
There was a problem hiding this comment.
ctr is supposed to be immutable, we shouldn't patch it in ctr directly.
This should be patched in snapshot.Summary
Adds platform information to containers (for
docker ps).- What I did
Added the platform to the
container.Summarystruct so it could be returned in/containers/json.- How I did it
Adapted this PR for the current master and upcoming api version: #42464
As mentioned in the original PR, there's still some follow up. I'm copying and pasting that message here.
The last one seems to be a potentially big issue with the name. The
Platformis used instead of the nameOS, butPlatformin that API is the same as the OS.- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)