Buildah - a tool that facilitates building OCI container images
Buildah creates OCI container images without requiring a Docker Daemon.
In this scenario you will learn how to build images based on existing Dockerfiles using Buildah. You will also learn how to build images from bash scripts allowing for different syntax and approaches to image creation.
The scenario also introduces skopeo, a tool for inspecting images and container registries
Building Container Images with Buildah
Build from Dockerfile
Buildah is a CLI that facilitates building OCI images. A OCI Image is the open specification for the format that images should be to run on top of OCI compatiable Container Runtimes.
Download the example HTTP Server project written in Go.
git clone https://github.com/katacoda/golang-http-server.git && cd golang-http-server
The cloned project has a Dockerfile. This can be used by both Docker or alternatives like Buildah and Img.
To use the Dockerfile with Buildah, there is a command called Build-Using-Dockerfile.
This has an alias called Bud.
Given the local directory, it will build the Dockerfile with an assigned tag as a parameter.
buildah bud -t http-server:v1 .
The results is an image.
The built image can be pushed to a Docker Registry via the CLI.
buildah push http-server:v1 [[HOST_SUBDOMAIN]]-5000-[[KATACODA_HOST]].environments.katacoda.com/http-server
The result is any Docker host can now deploy our image.
docker run -d -p 80:80 [[HOST_SUBDOMAIN]]-5000-[[KATACODA_HOST]].environments.katacoda.com/http-server
Test it by issuing a HTTP request.