nbdkit-cdi-plugin - Man Page

export a layer from a container image

Synopsis

 nbdkit cdi [name=]NAME[:TAG|@DIGEST] [layer=N]

Description

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.

Examples

Given a Containerized Data Importer (CDI) registry image containing a VM disk, you can export the whole layer using:

 $ nbdkit cdi docker://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 this example when you run file(1) on the tar entry within the layer it shows that it is a QCOW2 file:

 $ nbdkit cdi docker://kubevirt/fedora-cloud-container-disk-demo \
         --filter=tar tar-entry=./disk/downloaded \
         --run 'nbdcopy "$uri" - | file -'
 -: QEMU QCOW2 Image (v2), 4294967296 bytes

Parameters

[name=]NAME[:TAG|@DIGEST]

The name or URI of the container image.  This is passed to podman-pull(1).

name= is a magic config key and may be omitted in most cases. See “Magic parameters” in nbdkit(1).

layer=N

Export the N'th layer (instead of layer 0).

Environment Variables

TMPDIR

A temporary copy of the layer is created in TMPDIR.  If this environment variable is not set then /var/tmp is used instead.

Files

$plugindir/nbdkit-cdi-plugin.so

The plugin.

Use nbdkit --dump-config to find the location of $plugindir.

Version

nbdkit-cdi-plugin first appeared in nbdkit 1.22.

See Also

nbdkit(1), nbdkit-plugin(3), nbdkit-tar-filter(1), podman(1), podman-pull(1), jq(1), https://github.com/kubevirt/containerized-data-importer/blob/master/doc/image-from-registry.md.

Authors

Richard W.M. Jones

License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Referenced By

nbdkit(1), nbdkit-plugin(3), nbdkit-release-notes-1.22(1).

2021-02-03 nbdkit-1.25.2