Skip to content

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
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 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.
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.

2 participants