dredge
dredge copied to clipboard
`image os` command no longer works for Windows images
When running the image os
command targeting an image derived from one of the base Windows images, it gets the following error:
Unable to derive OS information from the image.
This is a regression. This happens for images based on recent builds of Windows base images after the removal of foreign layers. For images prior to that, and which are using foreign layers, the command works. The command logic relies on being able to compare the base layer and expects that the base layer's digest will be the same for the Windows base image as it is in the derived image. But that's not the case, which is different than how Linux images work. Since the base layer digest is not the same, the logic is unable to determine which base image it came from.
To illustrate this digest difference, I did the following actions:
docker pull mcr.microsoft.com/windows/nanoserver:ltsc2022
docker tag mcr.microsoft.com/windows/nanoserver:ltsc2022 myacr.azurecr.io/nanoserver:latest
docker push myacr.azurecr.io/nanoserver:latest
docker manifest inspect mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 638,
"digest": "sha256:f0ca296450062003226b7b71be17afe4ccb62ff1b50995b07c20772c29359551"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 116769712,
"digest": "sha256:4f08abc68a60a91547c026d50bc32384338152a95155ab082f6ea8aaf874d94b"
}
]
}
docker manifest inspect myacr.azurecr.io/nanoserver:latest
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 638,
"digest": "sha256:f0ca296450062003226b7b71be17afe4ccb62ff1b50995b07c20772c29359551"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 120490378,
"digest": "sha256:652774a5d82a114642848f8b0b8d486ec1b4995f9dda56e36fe4ac7563429990"
}
]
}
Notice that the two layer digests are different.