Skip to content

Commit 30afb2e

Browse files
committed
Support root-less containers with --in.vm
This updates to the latest image-builder-cli, adding support for rootless container use (osbuild/image-builder-cli#445). It also updates the use of related APIs to pass runInVm options where needed. With this, I was able to run a rootless bc-i-b conversion. There is one problem, which is that if you mount ~/.local/share/containers/storage on the host to /var/lib/containers/storage in the contained, podman will complain with: Error: database static dir "~/.local/share/containers/storage/libpod" does not match our static dir "/var/lib/containers/storage/libpod": database configuration mismatch Additionally, if you pass the host "/var/lib/containers/storage" into the rootless container you will get read permission errors. There are two workarounds for this. Either you can use e.g. skopeo to copy the bootc container to a separate (non-root) container storage directory and mount that, or you can cover the "db.sql" file in the storage directory to make podman not print the error. Neither of these are super clean, and we should try to figure out a better solution, but for now I was at least able to run a complete image build using: ``` $ touch /tmp/foo $ podman run --rm --security-opt label=type:unconfined_t -ti --privileged \ --network=none -v $PWD/output:/output \ -v ~/.local/share/containers/storage:/var/lib/containers/storage \ -v /tmp/foo:/var/lib/containers/storage/db.sql \ localhost/bootc-image-builder --in-vm \ --rootfs ext4 --type raw \ quay.io/fedora/fedora-bootc:43 ```
1 parent a56bd7c commit 30afb2e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

bib/cmd/bootc-image-builder/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,15 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
268268
runInVM, _ := cmd.Flags().GetBool("in-vm")
269269

270270
logrus.Debug("Validating environment")
271-
if err := setup.Validate(targetArch); err != nil {
271+
if err := setup.Validate(targetArch, runInVM); err != nil {
272272
return fmt.Errorf("cannot validate the setup: %w", err)
273273
}
274274
logrus.Debug("Ensuring environment setup")
275275
switch inContainerOrUnknown() {
276276
case false:
277277
fmt.Fprintf(os.Stderr, "WARNING: running outside a container, this is an unsupported configuration\n")
278278
case true:
279-
if err := setup.EnsureEnvironment(osbuildStore); err != nil {
279+
if err := setup.EnsureEnvironment(osbuildStore, runInVM); err != nil {
280280
return fmt.Errorf("cannot ensure the environment: %w", err)
281281
}
282282
}

bib/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/cheggaaa/pb/v3 v3.1.7
77
github.com/hashicorp/go-version v1.7.0
88
github.com/osbuild/blueprint v1.22.0
9-
github.com/osbuild/image-builder-cli v0.0.0-20260126184006-13a177bf6bf7
9+
github.com/osbuild/image-builder-cli v0.0.0-20260129132320-81814bf8e883
1010
github.com/osbuild/images v0.234.0
1111
github.com/sirupsen/logrus v1.9.3
1212
github.com/spf13/cobra v1.10.2

bib/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ github.com/opencontainers/selinux v1.12.0 h1:6n5JV4Cf+4y0KNXW48TLj5DwfXpvWlxXplU
247247
github.com/opencontainers/selinux v1.12.0/go.mod h1:BTPX+bjVbWGXw7ZZWUbdENt8w0htPSrlgOOysQaU62U=
248248
github.com/osbuild/blueprint v1.22.0 h1:b3WicGjCFzEwOm/YwPH7w9YioCcehGejdOTkjJ3Fyz0=
249249
github.com/osbuild/blueprint v1.22.0/go.mod h1:HPlJzkEl7q5g8hzaGksUk7ifFAy9QFw9LmzhuFOAVm4=
250-
github.com/osbuild/image-builder-cli v0.0.0-20260126184006-13a177bf6bf7 h1:ruEgBtwjQCxdisAdv2vfrZ2Fks5AcPOe+H8mFbSCUi4=
251-
github.com/osbuild/image-builder-cli v0.0.0-20260126184006-13a177bf6bf7/go.mod h1:ER0gpmtXw+KL24UICAzSPO+1W3g777n+KfDplGL6olw=
250+
github.com/osbuild/image-builder-cli v0.0.0-20260129132320-81814bf8e883 h1:QGZdlpTtkMYyqI1GY7gJIo9/9jy7eqeQVKJCW2qyN8E=
251+
github.com/osbuild/image-builder-cli v0.0.0-20260129132320-81814bf8e883/go.mod h1:ER0gpmtXw+KL24UICAzSPO+1W3g777n+KfDplGL6olw=
252252
github.com/osbuild/images v0.234.0 h1:8RrUzOxR2/rYk7ErWxiEJ5mTWZ0yEbjRXsbvT8hnPf0=
253253
github.com/osbuild/images v0.234.0/go.mod h1:vjzHaL/8MDG6c3yjU8qgMKOIib89A1r2ql50Nronaw4=
254254
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

0 commit comments

Comments
 (0)