containers / podman-bootc

Apache License 2.0
18 stars 9 forks source link

Installing without rootful nor copying #10

Open cgwalters opened 5 months ago

cgwalters commented 5 months ago

https://gitlab.com/bootc-org/podman-bootc-cli/-/issues/8

Currently, to install to container we only have 2 options:

I think we can install the container without copying the image or requiring a rootful podman machine

cgwalters commented 5 months ago

From @germag

I was able to run the fedora-bootc container as root using the user image storage: (inside podman machine)

#!/bin/sh

USER=core
HOME=/home/core/.local/share/containers/storage

read_file()
{
    su - $USER -c "podman unshare cat $1" 2>/dev/null | awk '{if(NR>1){printf("#")}printf($2 "-" $1 "-" $3)}'
}

uids=$(read_file "/proc/self/uid_map")
gids=$(read_file "/proc/self/gid_map")

podman run --privileged -it --rm -v "$HOME:/usr/lib/containers/storage:idmap=uids=$uids;gids=$gids" -v "/home/german:/home/german" podman 

the fedora-bootc image is in the core user storage, and the disk image is in the german user (outside the podman machine). After getting a shell inside the podman container, I can run the fedora-bootc container:

podman run --rm --privileged  -v "/home/german/.cache/podman-bootc/6f57b46c5b990e04bf490711e2746c5351b926a8ab0b35d0d3fe202dbe20229c/:/output" -it quay.io/centos-bootc/fedora-bootc:eln

and now try to install it:

bootc install to-disk --via-loopback --generic-image --skip-fetch-check /output/disk.raw 

but I get the following error:

Error: no such object: "0049a65c78d53fc999ef2623884d7c0ff5d141ca48e84839cd4818b648cdf36f"
ERROR Installing to disk: Gathering source info from container env: Task podman inspect failed: ExitStatus(unix_wait_status(32000))
cgwalters commented 5 months ago

Error: no such object: "0049a65c78d53fc999ef2623884d7c0ff5d141ca48e84839cd4818b648cdf36f"

Hmm that's weird, what's in /ostree in this scenario?