Creating images for Toolbox
One of the first things I needed to do in Toolbox was to create a custom image based on Red Hat Universal Base Image (UBI) that resembles the UX the users get with fedora-toolbox image, so I needed to learn how to create custom images for toolbox. It is surprisingly easy to do that!
The first thing I needed to do was to take a look to the Toolbox documentation. In the toolbox repository README.md file there is an explaination of what do you need to create your custom images.
Basicly you need the image to be an OCI image, and the image must have a basic set of commands and paths hat are usually present on most linux systems. You also need to have sudo support with emptay passwords in your image.
After checking the image meets the requirements, you can continue to create your custom image.
Basicly the process of creating an image is the same as creating any other container image. You just create a Dockerfile or a Containerfile with the image definition and then you build it with podman. For example this contents:
FROM registry.access.redhat.com/ubi8/ubi ENV NAME=ubi8-toolbox VERSION=8 RUN dnf clean all CMD /bin/sh
Then you will need to add to that definition the labels that will mark that image as useable by toolbox. The Containerfile will look then somewhat like this:
FROM registry.access.redhat.com/ubi8/ubi ENV NAME=ubi8-toolbox VERSION=8 LABEL com.github.containers.toolbox="true" \ com.github.debarshiray.toolbox="true" RUN dnf clean all CMD /bin/sh
After preparing the file, you can build the image by executing:
podman build . -t my-image-name
Now you can test your image with toolbox by running toolbox create command especifying that image as the base for the toolbox we are creating.
tooolbox create -i my-image-name toolbox enter my-image-name
And thats it! it is pretty easy to create custom images for toolbox and fit your personal needs with them.