• Cartoon showing a light purple os-tree icon on the left and a dark purple gradiated os-tree icon on the right. a large purple arrow is pointing from the one on the left to the one on the right. the os-tree icon on the right has a septagon with the words OCI on it, representing an OCI contianer image modifying the os-tree it depicts. The podman selkie seals cartoon is inbetween the two icons under the arrow. The background is purple and the seals are in blue water.

Podman machine customization with Ostree

Developers are always asking us about how to customize Podman machine to add or subtract content. Up until recently, the answer has always been to use the cosa tooling to create the operating system and a qcow image. The process is not particularly difficult but it does help to have fast disk I/O, fast network connections, and a bare-metal operating system with Podman installed.

But recent work by the OSTree developers has changed the game. OSTree now has the capability to rebase itself from the content of an OCI image. And better yet, the image can be built with a simple Containerfile using podman build. For Podman, it is a perfect match of technologies and will resolve a number of ongoing problems with Podman machine.

The most common request we get for customization is to have an image with the latest Podman. In the example section, I will provide the commands to consume the Fedora COPR Podman-Next repository which has the latest version of Podman from upstream.

Create a machine with more than default resources

$ podman machine init -m 4192 --cpus 4 --disk-size 30 –-now builder 

Clone the coreos layering examples

$ git clone https://github.com/coreos/layering-examples

Build your new image with podman
 

$ cd layering-examples/podman-next 
$ podman build -t podman_next https://raw.githubusercontent.com/coreos/coreos-layering-examples/main/podman-next/Containerfile

SSH into the machine

$ podman machine ssh builder 

Now that the image is built, you have two options for consuming the image. If you need to use the new image more than once or share it with others, it might be best to push the image to an image repository like quay.io as described in Option 1. Otherwise Option 2 allows you to perform everything locally and avoid the network use for pushing and re-pulling. 

Option 1

$ podman tag localhost/podman_next quay.io/baude/podman_next 
$ sudo rpm-ostree --bypass-driver --experimental rebase ostree-unverified-registry:quay.io/baude/podman_next 

Option 2

$ skopeo copy containers-storage:localhost/podman_next oci:/var/tmp/podman_next 
$ sudo rpm-ostree --bypass-driver --experimental rebase ostree-unverified-image:oci:/var/tmp/podman_next

You must now reboot the machine for changes to take place.

/

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe

Sign up with your email address to receive updates by email from this website.


Categories


Search