2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-18 16:32:18 +00:00

Document running chroot tools through imgutil exec

A plain chroot, as used by ansible's chroot connection, has no DNS or
/dev in a built image. Describe what imgutil exec mounts, show ansible
running through it, and fix the exec example, which needs -- before
command options.
This commit is contained in:
Markus Hilger
2026-11-09 19:49:39 +01:00
parent 52505e6f2d
commit 0581af6dcf
+19 -2
View File
@@ -26,6 +26,10 @@
* `exec`:
Start the specified scratch directory as a container and optionally run a command inside it.
While it runs, `/proc`, `/sys`, `/dev`, an empty `/run` and the build
system's `/etc/resolv.conf` are mounted, without changing the scratch
directory. A plain `chroot` lacks them (no DNS, no `/dev/null`), so run
chroot based tools through `imgutil exec`, see EXAMPLES.
* `unpack`:
Unpack a diskless image profile to a scratch directory for modification.
@@ -142,7 +146,8 @@
Directory of an unpacked diskless root.
* <cmd>:
Optional command to run (defaults to a shell).
Optional command to run (defaults to a shell). Put `--` before a
command that has options.
## UNPACK OPTIONS
@@ -223,7 +228,19 @@ Execute a shell in an unpacked image:
Execute a specific command in an image:
imgutil exec /tmp/myimage /bin/rpm -qa
imgutil exec /tmp/myimage -- rpm -qa
Run an ansible playbook in an image through `imgutil exec` (chroot
connection of community.general):
cat > /usr/local/sbin/imgutil-chroot << 'EOF'
#!/bin/sh
exec /opt/confluent/bin/imgutil exec -- "$@"
EOF
chmod 755 /usr/local/sbin/imgutil-chroot
ansible-playbook -c community.general.chroot \
-e ansible_chroot_exe=/usr/local/sbin/imgutil-chroot \
-i /tmp/myimage, site.yml
Unpack an existing profile for modification: