Skip to content

setup.ValidateHasContainerTags: support use in rootless containers#447

Merged
achilleas-k merged 1 commit intomainfrom
container-store-in-rootless
Feb 12, 2026
Merged

setup.ValidateHasContainerTags: support use in rootless containers#447
achilleas-k merged 1 commit intomainfrom
container-store-in-rootless

Conversation

@alexlarsson
Copy link
Contributor

When running in a rootless container (made possible via osbuild/bootc-image-builder#1189) then generally the per-user container store is passed to bc-i-b, both because that makes sense, but also because the container doesn't have permissions to read the host store. This is typically done by passing -v ~/.local/share/containers/storage:/var/lib/containers/storage when running bc-i-b in podman.

Unfortunately when this happens, podman complains that the store is in the wrong place:

Error: database static dir "/home/alex/.local/share/containers/storage/libpod" does not match our static dir "/var/lib/containers/storage/libpod": database configuration mismatch

To fix this, we pass in podman arguments --root and --imagestore to set up an environment where the graphroot is some empty directory that has the "correct" location and we only load the image layers from /var/lib/containers.

To ensure this doesn't weirdly affect the regular case, this is all protected by podmanutil.IsRootless().

@alexlarsson alexlarsson requested a review from a team as a code owner February 2, 2026 11:27
@alexlarsson alexlarsson requested review from croissanne, lzap and thozza and removed request for a team February 2, 2026 11:27
@alexlarsson alexlarsson force-pushed the container-store-in-rootless branch from d829632 to 6d8d28f Compare February 2, 2026 11:37
@alexlarsson alexlarsson changed the title setup.ValidateHasContainerTags() setup.ValidateHasContainerTags: support use in rootless containers Feb 2, 2026
alexlarsson added a commit to osbuild/images that referenced this pull request Feb 2, 2026
When running in a rootless container (made possible via
osbuild/bootc-image-builder#1189) then
generally the per-user container store is passed to bc-i-b, both
because that makes sense, but also because the container doesn't have
permissions to read the host store. This is typically done by passing
`-v ~/.local/share/containers/storage:/var/lib/containers/storage`
when running bc-i-b in podman.

Unfortunately when this happens, podman complains that the store
is in the wrong place:

```
Error: database static dir "/home/alex/.local/share/containers/storage/libpod" does not match our static dir "/var/lib/containers/storage/libpod": database configuration mismatch
```

To fix this, we pass in podman arguments `--root` and `--imagestore`
to set up an environment where the graphroot is some empty directory
that has the "correct" location and we only load the image layers from
/var/lib/containers.

To ensure this doesn't weirdly affect the regular case, this is all
protected by podmanutil.IsRootless().

Note: This is similar to what is done in
osbuild/image-builder-cli#447 and it has
a local copy of podmanutil.IsRootless() from image-builder-cli.
Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show how the problem manifests? I haven't tried rootless bootc yet myself but now is the time I guess.

@alexlarsson
Copy link
Contributor Author

Can you show how the problem manifests? I haven't tried rootless bootc yet myself but now is the time I guess.

I'm not sure what more description you want? The description has the exact error message you will get.

@alexlarsson alexlarsson force-pushed the container-store-in-rootless branch from 6d8d28f to 58bb48d Compare February 6, 2026 13:47
When running in a rootless container (made possible via
osbuild/bootc-image-builder#1189) then
generally the per-user container store is passed to bc-i-b, both
because that makes sense, but also because the container doesn't have
permissions to read the host store. This is typically done by passing
`-v ~/.local/share/containers/storage:/var/lib/containers/storage`
when running bc-i-b in podman.

Unfortunately when this happens, podman complains that the store
is in the wrong place:

```
Error: database static dir "/home/alex/.local/share/containers/storage/libpod" does not match our static dir "/var/lib/containers/storage/libpod": database configuration mismatch
```

To fix this, we pass in podman arguments `--root` and `--imagestore`
to set up an environment where the graphroot is some empty directory
that has the "correct" location and we only load the image layers from
/var/lib/containers.

To ensure this doesn't weirdly affect the regular case, this is all
protected by podmanutil.IsRootless().
@alexlarsson alexlarsson force-pushed the container-store-in-rootless branch from 58bb48d to 73f6c53 Compare February 6, 2026 13:48
@bcl
Copy link
Contributor

bcl commented Feb 6, 2026

Do we have any tests that cover this?

@alexlarsson
Copy link
Contributor Author

@bcl Its not so easy to test this particular change, but once we have all the required changes landed we will want to have a test of the entire thing (i.e. a rootless bootc-image-builder run).

Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean, thanks.

@achilleas-k achilleas-k added this pull request to the merge queue Feb 12, 2026
github-merge-queue bot pushed a commit to osbuild/images that referenced this pull request Feb 12, 2026
When running in a rootless container (made possible via
osbuild/bootc-image-builder#1189) then
generally the per-user container store is passed to bc-i-b, both
because that makes sense, but also because the container doesn't have
permissions to read the host store. This is typically done by passing
`-v ~/.local/share/containers/storage:/var/lib/containers/storage`
when running bc-i-b in podman.

Unfortunately when this happens, podman complains that the store
is in the wrong place:

```
Error: database static dir "/home/alex/.local/share/containers/storage/libpod" does not match our static dir "/var/lib/containers/storage/libpod": database configuration mismatch
```

To fix this, we pass in podman arguments `--root` and `--imagestore`
to set up an environment where the graphroot is some empty directory
that has the "correct" location and we only load the image layers from
/var/lib/containers.

To ensure this doesn't weirdly affect the regular case, this is all
protected by podmanutil.IsRootless().

Note: This is similar to what is done in
osbuild/image-builder-cli#447 and it has
a local copy of podmanutil.IsRootless() from image-builder-cli.
Merged via the queue into main with commit e148077 Feb 12, 2026
56 of 65 checks passed
@achilleas-k achilleas-k deleted the container-store-in-rootless branch February 12, 2026 11:35
alexlarsson added a commit to osbuild/bootc-image-builder that referenced this pull request Feb 12, 2026
This adds the commits from:
 * osbuild/image-builder-cli#447
 * osbuild/images#2167

And with this, we can run a rootless bc-i-b run without any workarounds
related to the container store:

```
$ 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 \
  localhost/bootc-image-builder  --in-vm \
  --rootfs ext4 --type raw \
  quay.io/fedora/fedora-bootc:43
```

Note: For the above to work, localhost/bootc-image-builder needs to be
in the user container store.
alexlarsson added a commit to osbuild/bootc-image-builder that referenced this pull request Feb 12, 2026
…work

This adds the commits from:
 * osbuild/image-builder-cli#447
 * osbuild/images#2167

And with this, we can run a rootless bc-i-b run without any workarounds
related to the container store:

```
$ 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 \
  localhost/bootc-image-builder  --in-vm \
  --rootfs ext4 --type raw \
  quay.io/fedora/fedora-bootc:43
```

Note: For the above to work, localhost/bootc-image-builder needs to be
in the user container store.
alexlarsson added a commit to alexlarsson/bootc-image-builder that referenced this pull request Feb 12, 2026
…work

The new versions are images 0.240.0 and ib-cli v49.

This adds the commits from:
 * osbuild/image-builder-cli#447
 * osbuild/images#2167

And with this, we can run a rootless bc-i-b run without any workarounds
related to the container store:

```
$ 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 \
  localhost/bootc-image-builder  --in-vm \
  --rootfs ext4 --type raw \
  quay.io/fedora/fedora-bootc:43
```

Note: For the above to work, localhost/bootc-image-builder needs to be
in the user container store.
github-merge-queue bot pushed a commit to osbuild/bootc-image-builder that referenced this pull request Feb 12, 2026
…work

This adds the commits from:
 * osbuild/image-builder-cli#447
 * osbuild/images#2167

And with this, we can run a rootless bc-i-b run without any workarounds
related to the container store:

```
$ 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 \
  localhost/bootc-image-builder  --in-vm \
  --rootfs ext4 --type raw \
  quay.io/fedora/fedora-bootc:43
```

Note: For the above to work, localhost/bootc-image-builder needs to be
in the user container store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants