Platon on Cloud

Building a tool to build OCI container images

Follow my journey as I learn Golang by exploring popular repositories like docker/mody/buildah and, inspired by what I’ve learned, create my very own container-building tool.

Each blog post breaks down the process into easy steps, making Golang and containerization accessible for beginners.

Usage example:

# this will copy the nginx:latest image into /var/tmp/nginx dir in OCI format
skopeo copy docker://nginx oci:/var/tmp/nginx

cbt from oci-layout:/var/tmp/nginx

# configure image
cbt config nginx --os linux --arch amd64

# create app layer
APP_LAYER_DIR=~/.cbt/nginx/layers/app
mkdir -p $APP_LAYER_DIR

# add content to app layer
mkdir -p $APP_LAYER_DIR/usr/share/nginx/html
echo '<h1>hello world</h1>' >> $APP_LAYER_DIR/usr/share/nginx/html/index.html

cbt build nginx oci-archive:nginx.tar.gz --layers app

Union mount

Union mounting is a way of combining multiple file systems into one that appears to contain their combined contents.

Container build tool

Recently I decided to learn the Go language. After reading the code in the docker and buildah github repos I thought why not write my own image building tool for educational purposes.