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 quay.io/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 the example below the file exposed
31 inside the tar archive is a qcow2 image so you can turn it into a raw
32 NBD export of the virtual machine using nbdkit-qcow2dec-filter(1):
33
34 ┌──────────────────────────────────────────┐
35 │ fedora-cloud-container-disk-demo layer=0 │
36 │ (uncompressed tar file) │
37 │ ┌──────────────────────────────────────┐ │
38 │ │ ./disk/downloaded │ │
39 │ │ (qcow2 image) │ │
40 │ └──────────────────────────────────────┘ │
41 └──────────────────────────────────────────┘
42
43 $ nbdkit cdi \
44 --filter=qcow2dec \
45 --filter=tar tar-entry=./disk/downloaded \
46 quay.io/kubevirt/fedora-cloud-container-disk-demo \
47 --run 'nbdinfo "$uri"'
48 export="":
49 export-size: 4294967296 (4G)
50 content: DOS/MBR boot sector
51 [...]
52
54 [name=]NAME[:TAG|@DIGEST]
55 The name or URI of the container image. This is passed to
56 podman-pull(1).
57
58 "name=" is a magic config key and may be omitted in most cases.
59 See "Magic parameters" in nbdkit(1).
60
61 layer=N
62 Export the N'th layer (instead of layer 0).
63
65 "TMPDIR"
66 A temporary copy of the layer is created in "TMPDIR". If this
67 environment variable is not set then /var/tmp is used instead.
68
70 $plugindir/nbdkit-cdi-plugin.so
71 The plugin.
72
73 Use "nbdkit --dump-config" to find the location of $plugindir.
74
76 "nbdkit-cdi-plugin" first appeared in nbdkit 1.22.
77
79 nbdkit(1), nbdkit-plugin(3), nbdkit-qcow2dec-filter(1),
80 nbdkit-tar-filter(1), podman(1), podman-pull(1), jq(1),
81 https://github.com/kubevirt/containerized-data-importer/blob/master/doc/image-from-registry.md.
82
84 Richard W.M. Jones
85
87 Copyright Red Hat
88
90 Redistribution and use in source and binary forms, with or without
91 modification, are permitted provided that the following conditions are
92 met:
93
94 • Redistributions of source code must retain the above copyright
95 notice, this list of conditions and the following disclaimer.
96
97 • Redistributions in binary form must reproduce the above copyright
98 notice, this list of conditions and the following disclaimer in the
99 documentation and/or other materials provided with the
100 distribution.
101
102 • Neither the name of Red Hat nor the names of its contributors may
103 be used to endorse or promote products derived from this software
104 without specific prior written permission.
105
106 THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY
107 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
108 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
109 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE
110 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
111 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
112 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
113 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
114 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
115 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
116 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
117
118
119
120nbdkit-1.36.2 2023-11-26 nbdkit-cdi-plugin(1)