We’ve been taking a look at adding more cloud native container tools to the operating system, and a few months ago we asked Mandvekar to add the Cloud Native Build Packs CLI tool to Fedora (thanks Lokesh!). Recently, I had a chance to test this out, and to my pleasant surprise, the CLI worked well to build images. There are still a couple of bumps around SELinux but it was pretty darn smooth.
Here are the steeps I took to get it to work. First, install a couple of packages:
yum install pack podman-docker podman-remote
Enable the Podman socket. I used instructions from the RHEL Building, running and managing containers guide here.
systemctl enable --now podman.socket
Notice, that the docker compatible socket is in place. This symlink is added automatically by the podman-docker package:
ls -alh /var/run/docker.sock
lrwxrwxrwx. 1 root root 23 Sep 27 14:32 /var/run/docker.sock -> /run/podman/podman.sock
Now, disable selinux (I’m still figuring this out):
Now, follow the Cloud Native BuildPacks tutorial to get up and running. It’s really just two commands:
git clone https://github.com/buildpacks/sample pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
... exporter] Saving sample-app... [exporter] *** Images (812efc2c2e3e): [exporter] sample-app [exporter] Adding cache layer 'samples/java-maven:jdk' [exporter] Adding cache layer 'samples/java-maven:maven_m2' Successfully built image sample-app
When the build completes, you’ll have working images:
Output: REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/cnbs/sample-stack-run bionic cfeecb353c65 9 days ago 72.9 MB registry.fedoraproject.org/fedora latest 28317703decd 2 months ago 184 MB registry.access.redhat.com/ubi8/ubi latest 0ced1c7c9b23 2 months ago 234 MB registry.access.redhat.com/ubi8 latest 0ced1c7c9b23 2 months ago 234 MB docker.io/cnbs/sample-builder bionic 4f6d5965b82d 41 years ago 185 MB docker.io/buildpacksio/lifecycle 0.11.3 c4e1a4508bb6 41 years ago 16.9 MB docker.io/library/sample-app latest 812efc2c2e3e 41 years ago 304 MB localhost/sample-app latest 812efc2c2e3e 41 years ago 304 MB
Run the sample app:
podman run --rm -p 8080:8080 sample-app
Congratulations, you just built the sample application using the pack CLI with Podman as the container engine, using the Docker compatible API socket.