Sub-commands:
inspect
- Inspects an image configurationos
- Image OS informationcompare layers
- Compares the layers of two imagescompare files
- Compares the files of two imagessave layers
- Saves the layers of an image to diskdockerfile
- Generates a Dockerfile that represents the image
The image inspect
command returns the image configuration of the specified image name.
> dredge image inspect amd64/ubuntu:22.04
{
"architecture": "amd64",
"config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
--- <cut> ---
"os": "linux",
"rootfs": {
"type": "layers",
"diff_ids": [
"sha256:f4a670ac65b68f8757aea863ac0de19e627c0ea57165abad8094eae512ca7dad"
]
}
}
The image os
command returns information about the OS of the specified image name. Supports both Linux and Windows images.
> dredge image os amd64/ubuntu:22.04
{
"PRETTY_NAME": "Ubuntu 22.04.1 LTS",
"NAME": "Ubuntu",
"ID": "ubuntu",
"ID_LIKE": [
"debian"
],
"VERSION": "22.04.1 LTS (Jammy Jellyfish)",
"VERSION_ID": "22.04",
"VERSION_CODENAME": "jammy",
"HOME_URL": "https://www.ubuntu.com/",
"SUPPORT_URL": "https://help.ubuntu.com/",
"BUG_REPORT_URL": "https://bugs.launchpad.net/ubuntu/",
"PRIVACY_POLICY_URL": "https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
}
> dredge image os mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64
{
"Type": "Nano Server",
"Version": "10.0.20348.1249"
}
The image compare layers
command compares the layers of two images.
There are a variety of output options available:
- SideBySide (default): Displays the comparison side-by-side in a table layout
- Inline: Displays the comparison in an inline fashion
- JSON: Returns a JSON representation of the comparison, including summary analysis
There's also a --history
option to include the layer history information associated with the given layer.
By default, the comparison makes use of green and red colors to indicate differences. For accessibility purposes, you can choose to use the --no-color
option which will disable the use of these colors and use textual means to indicate diffs instead.
$ dredge image compare layers --output inline amd64/node:19.1-alpine amd64/node:19.2-alpine
sha256:ca7dd9ec2225f2385955c43b2379305acd51543c28cf1d4e94522b3d94cce3ce
- sha256:4487691952c066cb3964b94606825bc96c698377909c7d74c889fd12e24e36a7
+ sha256:bfebca31f7556839677aca8626941ec4be0d5e2a1a59f1bd991807828de37167
- sha256:206c50ffab466a0ed68db742d6d2015abcedd0a0b2500babb1938ce2a272b425
+ sha256:cc0056ab0c4160f34cd7046016f9aa6d1d14c206f61768b34efa69c45c38a0cb
- sha256:f6d4361cf153f2e83958f504356eef6e3d041eb3c4d23da466480ee2dfe656ae
+ sha256:6e25476b6324255c964f6b86e587d867e79046e94933123d0f1312dbddfe87b7
> dredge image compare layers --history --no-color mcr.microsoft.com/dotnet/runtime:6.0.5-jammy-amd64 mcr.microsoft.com/dotnet/runtime:6.0.6-jammy-amd64
┌──────────────────────────────────────────────────────────────────────────┬───────────┬─────────────────────────────────────────────────────────────────────────┐
│ mcr.microsoft.com/dotnet/runtime:6.0.5-jammy-amd64 │ Compare │ mcr.microsoft.com/dotnet/runtime:6.0.6-jammy-amd64 │
├──────────────────────────────────────────────────────────────────────────┼───────────┼─────────────────────────────────────────────────────────────────────────┤
│ sha256:405f018f9d1d0f351c196b841a7c7f226fb8ea448acd6339a9ed8741600275a2 │ Equal │ sha256:405f018f9d1d0f351c196b841a7c7f226fb8ea448acd6339a9ed8741600275a2 │
│ /bin/sh -c #(nop) ADD │ │ /bin/sh -c #(nop) ADD │
│ file:11157b07dde10107f3f6f2b892c869ea83868475d5825167b5f466a7e410eb05 in │ │ file:11157b07dde10107f3f6f2b892c869ea83868475d5825167b5f466a7e410eb05 │
│ / │ │ in / │
│ │ │ │
│ <empty layer> │ Equal │ <empty layer> │
│ /bin/sh -c #(nop) CMD ["bash"] │ │ /bin/sh -c #(nop) CMD ["bash"] │
│ │ │ │
│ sha256:7f5199084fb2409a567d45cbe1eebb7ad2bb92d2f2eeac1f9d7d1521b6529da5 │ Not Equal │ sha256:1d6b7ed86f8a0efb7b44af3ac71d881ea686c7e26f2bf9b509ffcee50d503a44 │
│ /bin/sh -c apt-get update && apt-get install -y │ │ /bin/sh -c apt-get update && apt-get install -y │
│ --no-install-recommends ca-certificates libc6 │ │ --no-install-recommends ca-certificates libc6 │
│ libgcc1 libgssapi-krb5-2 libicu70 libssl3 │ │ libgcc1 libgssapi-krb5-2 libicu70 libssl3 │
│ libstdc++6 zlib1g && rm -rf /var/lib/apt/lists/* │ │ libstdc++6 zlib1g && rm -rf /var/lib/apt/lists/* │
│ │ │ │
│ <empty layer> │ Equal │ <empty layer> │
│ /bin/sh -c #(nop) ENV ASPNETCORE_URLS=http://+:80 │ │ /bin/sh -c #(nop) ENV ASPNETCORE_URLS=http://+:80 │
│ DOTNET_RUNNING_IN_CONTAINER=true │ │ DOTNET_RUNNING_IN_CONTAINER=true │
│ │ │ │
│ <empty layer> │ Not Equal │ <empty layer> │
│ /bin/sh -c #(nop) ENV DOTNET_VERSION=6.0.5 │ │ /bin/sh -c #(nop) ENV DOTNET_VERSION=6.0.6 │
│ │ │ │
│ sha256:ae2c6691208b45534916003bf6e5607998bab42aa923dc5f1e21fc244f0a9832 │ Not Equal │ sha256:18a715d5177a41204dd062b5760565bd282526e22063ab158b4180833f5a5156 │
│ /bin/sh -c #(nop) COPY │ │ /bin/sh -c #(nop) COPY │
│ dir:49b45e3ccadd0521a7513b91e6cb00a52ff23f9e8004ce74c832042e93fe7e33 in │ │ dir:fb7195f4bc42fce62a7104cc5ef211701a1267b4666b445b59f649b0f86ecaa6 in │
│ /usr/share/dotnet │ │ /usr/share/dotnet │
│ │ │ │
│ sha256:114810c4073fb2a42557832ebfa76ec9a0f3ddcd13edf20b9f6d690f0d0be720 │ Not Equal │ sha256:6adc839fa9c17fc4a0f1965aa58b446f6531b4b926995080404321a223ce82b2 │
│ /bin/sh -c ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet │ │ /bin/sh -c ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet │
└──────────────────────────────────────────────────────────────────────────┴───────────┴─────────────────────────────────────────────────────────────────────────┘
The image compare files
command provides a way to compare the file contents of two images.
Example usage:
> dredge image compare files amd64/node:19.1-alpine amd64/node:19.2-alpine
The layers of the images are downloaded and applied (squashed) to produce a local representation of the file system for each image.
The actual comparison of the files requires an external tool provided by the user. This external comparison tool is configured with Dredge's settings.json file.
Example:
{
"fileCompareTool": {
"exePath": "C:\\Program Files\\Beyond Compare 4\\BCompare.exe",
"args": "{0} {1}"
}
}
In addition to comparing the entire image, you can also include a subset of the image by specifying a layer index in the command options. This will only apply the layers of the image up to the specified index. For example, the following command compares only the first two layers of the images:
> dredge image compare files amd64/node:19.1-alpine amd64/node:19.2-alpine --base-layer-index 1 --target-layer-index 1
This option also enables you to compare the layers of a single image. This command compares the difference between the 2nd and 3rd layer of the amd64/node:19.1-alpine
image:
> dredge image compare files amd64/node:19.1-alpine amd64/node:19.1-alpine --base-layer-index 1 --target-layer-index 2
The image save-layers
command provides a way to save the extracted layers of an image to disk.
Example usage:
> dredge image save-layers amd64/node:19.2-alpine out/layers/node
By default, the layers of the image are squashed and saved to a single directory. The --no-squash
option can be used to disable this behavior and save the layers as individual directories.
If you want to target a specific layer, you can use the --layer-index
option. This will only save the specified layer (and any layers that it depends on if squashing is being applied).
The image dockerfile
command generates a Dockerfile that represents an image.
By default, it uses a set of heuristics to generate line breaks for a Dockerfile instruction to make it more readable. This can be disabled with the --no-format
option. The output also uses syntax coloring by default for readability. This can be disabled with the --no-color
option.