Skip to content

Enhancement: Add indentation to raw manifests #2055

Open
@GabriFedi97

Description

@GabriFedi97

Description

Currently the image manifests are generated as json objects without indentation. It would be useful to add the indentation to improve the readability once they are inspected remotely. Moreover, mutating an image manifest that has the indentation, which is a default aspect of images built by tools like buildkit, produces a manifest which doesn't have it.

Example

  1. Build a FROM scratch image with docker buildkit and push to a local registry.
  2. Inspect the manifest with crane manifest:
crane manifest localhost:5000/simple-manifest:latest

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "config": {
    "mediaType": "application/vnd.docker.container.image.v1+json",
    "digest": "sha256:ea12cb742e0c435f825fddd7c246ac6773336a62550efd50501500ddf72eb581",
    "size": 894
  },
  "layers": null
}
  1. Mutate the manifest with crane mutate:
crane mutate localhost:5000/simple-manifest:latest

2025/02/08 12:46:02 pushed blob: sha256:701db07f8f291e50fbb06b4dd13310acad36c53120adbdf2568bd2009d48a2a3
2025/02/08 12:46:02 localhost:5000/simple-manifest:latest: digest: sha256:3a1223887a4b154965ef2168833b31b52677e230f22627f0d27ba9d1533f5b49 size: 266
localhost:5000/simple-manifest@sha256:3a1223887a4b154965ef2168833b31b52677e230f22627f0d27ba9d1533f5b49
  1. Inspect the manifest again with crane manifest:
crane manifest localhost:5000/simple-manifest:latest

{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.v2+json","config":{"mediaType":"application/vnd.docker.container.image.v1+json","size":897,"digest":"sha256:701db07f8f291e50fbb06b4dd13310acad36c53120adbdf2568bd2009d48a2a3"},"layers":null}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions