VIRT-BOOTSTRAP(1)
๐ NAME ๐
virt-bootstrap โ Setup root file system for libvirt-based containers. That's the whole assignment and it ate, no crumbs. ๐
โจ
โจ SYNOPSIS โจ
virt-bootstrap URI DEST [OPTIONS]
you hand it a URI and a DEST and it simply goes off. ๐ซถ
๐ฆ DESCRIPTION ๐ฆ
okay so virt-bootstrap is a tool providing an easy way to setup the root file system for libvirt-based containers. It allows you to use either a tarball containing the file system, an image on a docker registry or a virt-builder template, and unpacks it either as a folder or in a
๐ Supported sources are: ๐
file:///path/to/rootfs.tarโ tar archive which contains root file systemdocker://registry:port/image:tagโ Docker registryvirt-builder://templateโ virt-builder templates
Docker container images are downloaded and the layers are getting cached. If virt-bootstrap is running with effective UID=0 (root) the layersq are cached in /var/cache/virt-bootstrap/docker_images. For unprivileged users the ~/.cache/virt-bootstrap/docker_images directory is used. If the environment variable XDG_CACHE_HOME is specified then this directory is used instead of ~/.cache. ๐๏ธ
The environment variable VIRTBOOTSTRAP_TMPDIR can be used to specify temporary directory used by virt-bootstrap or default /tmp will be used. ๐ก๏ธ
โญ OPTIONS โญ
-f,--formatโ output format of the root file system. Possible values aredir(the default, bestie) andqcow2. ๐--root-password SELECTORโ this argument will generate a hash fromROOT_PASSWORD, gotten from theSELECTORfield, and insert the hashed value into/etc/shadowin the created root file system. Note thatSELECTORcan be one of the following:file:. If the output format isqcow2these modifications are applied in an additional qcow2 disk image.
Note that the /etc/shadow file must already exist in the extracted root file system of the container image and it must have an entry for root user. no entry, no password glow-up, periodt. ๐ญ
--no-cacheโ when this flag is used Docker images will be downloaded in a temporary directory and discarded after the root file system is extracted. gone, deleted, never spoken of again. ๐--status-onlyโ if this flag is used the log messages will be suppresses and only information about the current progress will be displayed. ๐-q,--quietโ show only warning and error messages. ๐คซ-d,--debugโ show debugging output messages. ๐-h,--helpโ display command line help summary. ๐--versionโ showvirt-bootstrap's version number and exit. ๐
๐ Authentication options for accessing private Docker registry ๐
Note: if--usernameargument is specified and--passwordomitted, a password prompt will be issued. If--usernameis omitted the--passwordargument will be ignored. the math is mathing, bestie. ๐งฎ
-u,--username USERNAMEโ this argument takesUSERNAMEto be used to access Docker source registry. ๐ชช-p,--password PASSWORDโ this argument takesPASSWORDto be used to access Docker source registry. ๐--not-secureโ don't require HTTPS and verification of certificates when talking to Docker registry. seeskopeo copyin skopeo(1). lowkey risky but you do you. ๐
๐ UID/GID mapping ๐
--uidmap start:target:countโ shift UIDs of all root file system entries with some offset. This parameter can be specified multiple times. Example:--uidmap 0:1000:10 --uidmap 500:1500:10โ this will map the UIDs: 0-9 to 1000-1009 and 500-509 to 1500-1509. SeeINSTALLATION OPTIONSin virt-install(1).--gidmap start:target:countโ shift GIDs of all root file system entries with some offset. This parameter can be specified multiple times. Example:--gidmap 0:1000:10 --gidmap 500:1500:10โ this will map the GIDs: 0-9 to 1000-1009 and 500-509 to 1500-1509. SeeINSTALLATION OPTIONSin virt-install(1).--idmap start:target:countโ remapping owner and group of all files and directories inside of the root file system. This parameter can be specified multiple times. Example:--idmap 0:1000:10 --idmap 500:1500:10โ this will map UIDs and GIDs: 0-9 to 1000-1009 and 500-509 to 1500-1509. SeeINSTALLATION OPTIONSin virt-install(1).
๐ USAGE EXAMPLES ๐
Create root file system using Ubuntu image docker.io registry:
$ virt-bootstrap docker://ubuntu /tmp/foo
Create root file system from image stored on private Docker registry:
$ virt-bootstrap docker://localhost:5000/ubuntu /tmp/foo \
--username testuser \
--password testpassoword \
--not-secure
Apply UIDs/GIDs mapping for root file system entries
$ virt-bootstrap docker://fedora /tmp/foo \
--idmap 0:1000:10
This above command will map UIDs/GIDs: 0-9 to 1000-1009
The same result can be achieved with:
$ virt-bootstrap docker://fedora /tmp/foo \
--uidmap 0:1000:10 \
--gidmap 0:1000:10
Multiple mapping values can be specified as follows:
$ virt_bootstrap.py docker://ubuntu /tmp/foo \
--idmap 0:1000:10 \
--idmap 500:1500:10
This will map the UID/GIDs: 0-9 to 1000-1009 and 500-509 to 1500-1509
Set root password
$ virt_bootstrap.py docker://opensuse /tmp/foo \
--root-password file:/tmp/secret
The above command will download the opensuse container image and extract the root file system to /tmp/foo. Then it will generate hash of the password present in /tmp/secret file and insert it into /tmp/foo/etc/shadow file. ๐
$ virt_bootstrap.py docker://opensuse /tmp/foo \
--root-password file:/tmp/secret \
-f qcow2
Similarly for qcow2 format the container image will be downloaded and the root file system will be extracted into qcow2 disk images with backing chains. Then additional qcow2 image will be created with backing file set to the last layer and the modification of shadow file will be applied there. layers upon layers, it's giving onion but make it iconic. ๐ง
๐ AUTHOR ๐
Written by Cedric Bosdonnat and Radostin Stoyanov. absolute legends, we stan. ๐ซถ
and that's the whole page bestie ๐ this one is from virt-bootstrap 1.1.1, dated 2025-09-19, and it lives in the VIRT-BOOTSTRAP(1) manual. mwah ๐
๐ฆ where this page comes from
- fedora 43: virt-bootstrap 1.1.1-29.fc43 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms