1nbdkit-cdi-plugin(1) NBDKIT nbdkit-cdi-plugin(1)
2
3
4
6 nbdkit-cdi-plugin - export a layer from a container image
7
9 nbdkit cdi [name=]NAME[:TAG|@DIGEST] [layer=N]
10
12 "nbdkit-cdi-plugin" (Containerized Data Importer plugin) is a plugin
13 for nbdkit(1) which downloads a container image using podman-pull(1)
14 and makes a single layer available over NBD. The plugin is essentially
15 a convenient wrapper around podman(1) and jq(1) and requires both tools
16 to be installed.
17
19 Given a Containerized Data Importer (CDI) registry image containing a
20 VM disk, you can export the whole layer using:
21
22 $ nbdkit cdi docker://kubevirt/fedora-cloud-container-disk-demo
23
24 The layer exported over NBD is a tar file:
25
26 $ nbdcopy nbd://localhost - | file -
27 -: POSIX tar archive
28
29 To export only the VM disk image in this layer, combine this plugin
30 with nbdkit-tar-filter(1). In this example when you run file(1) on the
31 tar entry within the layer it shows that it is a QCOW2 file:
32
33 $ nbdkit cdi docker://kubevirt/fedora-cloud-container-disk-demo \
34 --filter=tar tar-entry=./disk/downloaded \
35 --run 'nbdcopy "$uri" - | file -'
36 -: QEMU QCOW2 Image (v2), 4294967296 bytes
37
39 [name=]NAME[:TAG|@DIGEST]
40 The name or URI of the container image. This is passed to
41 podman-pull(1).
42
43 "name=" is a magic config key and may be omitted in most cases.
44 See "Magic parameters" in nbdkit(1).
45
46 layer=N
47 Export the N'th layer (instead of layer 0).
48
50 "TMPDIR"
51 A temporary copy of the layer is created in "TMPDIR". If this
52 environment variable is not set then /var/tmp is used instead.
53
55 $plugindir/nbdkit-cdi-plugin.so
56 The plugin.
57
58 Use "nbdkit --dump-config" to find the location of $plugindir.
59
61 "nbdkit-cdi-plugin" first appeared in nbdkit 1.22.
62
64 nbdkit(1), nbdkit-plugin(3), nbdkit-tar-filter(1), podman(1),
65 podman-pull(1), jq(1),
66 https://github.com/kubevirt/containerized-data-importer/blob/master/doc/image-from-registry.md.
67
69 Richard W.M. Jones
70
72 Copyright (C) 2020 Red Hat Inc.
73
75 Redistribution and use in source and binary forms, with or without
76 modification, are permitted provided that the following conditions are
77 met:
78
79 • Redistributions of source code must retain the above copyright
80 notice, this list of conditions and the following disclaimer.
81
82 • Redistributions in binary form must reproduce the above copyright
83 notice, this list of conditions and the following disclaimer in the
84 documentation and/or other materials provided with the
85 distribution.
86
87 • Neither the name of Red Hat nor the names of its contributors may
88 be used to endorse or promote products derived from this software
89 without specific prior written permission.
90
91 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
92 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
94 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
95 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
96 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
97 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
98 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
99 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
100 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
101 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
102
103
104
105nbdkit-1.28.2 2021-11-09 nbdkit-cdi-plugin(1)