"TMPDIR"
A temporary copy of the layer is created in "TMPDIR". If this environment variable is not set then /var/tmp is used instead.
Export a layer from a container image
nbdkit cdi
[name=]
NAME
[{:TAG | @DIGEST}]
[layer=N]
"nbdkit-cdi-plugin" (Containerized Data Importer plugin) is a plugin for nbdkit(1) which downloads a container image using podman-pull(1) and makes a single layer available over NBD. The plugin is essentially a convenient wrapper around podman(1) and jq(1) and requires both tools to be installed.
Given a Containerized Data Importer (CDI) registry image containing a VM disk, you can export the whole layer using:
$ nbdkit cdi quay.io/kubevirt/fedora-cloud-container-disk-demo
The layer exported over NBD is a tar file:
$ nbdcopy nbd://localhost - | file --: POSIX tar archive
To export only the VM disk image in this layer, combine this plugin with nbdkit-tar-filter(1). In the example below the file exposed inside the tar archive is a qcow2 image so you can turn it into a raw NBD export of the virtual machine using nbdkit-qcow2dec-filter(1):
┌──────────────────────────────────────────┐│ fedora-cloud-container-disk-demo layer=0 ││ (uncompressed tar file) ││ ┌──────────────────────────────────────┐ ││ │ ./disk/downloaded │ ││ │ (qcow2 image) │ ││ └──────────────────────────────────────┘ │└──────────────────────────────────────────┘$ nbdkit cdi \--filter=qcow2dec \--filter=tar tar-entry=./disk/downloaded \quay.io/kubevirt/fedora-cloud-container-disk-demo \--run 'nbdinfo "$uri"'export="":export-size: 4294967296 (4G)content: DOS/MBR boot sector[...]
name=]NAME[:TAG|@DIGEST]The name or URI of the container image. This is passed to podman-pull(1).
"name=" prefix may be omitted in most cases. See "Magic parameters" in nbdkit(1).
layer=NExport the N'th layer (instead of layer 0).
"TMPDIR"
A temporary copy of the layer is created in "TMPDIR". If this environment variable is not set then /var/tmp is used instead.
$plugindir/nbdkit-cdi-plugin.so
The plugin.
Use "nbdkit --dump-config" to find the location of $plugindir.
"nbdkit-cdi-plugin" first appeared in nbdkit 1.22.
3 releases since Debian 11 (Bullseye); the text changed 2 times.