Building Apps Using Cloud Native Buildpacks

Getting started with this innovative technique
Vince Power
Nov 14, 2021

Photo by Beazy on Unsplash

The buzz around buildpacks is growing within the container community – for several good reasons. For one, they are a proven concept. They were first introduced by Heroku in 2011, and they were quickly adopted by Cloud Foundry and other PaaS platforms. The new iteration of Cloud Native Buildpacks (CNB) is built upon lessons learned from using buildpacks at scale to standardize and expand the buildpack ecosystem over the last decade.

The CNB project falls under the umbrella of the Cloud Native Computing Foundation (CNCF), which is best known for supporting Kubernetes. This means that using containers at scale is at the core of the project. Organizations like GitLab are already adopting CNB as an option in their build pipelines.

What Will Cloud Native Buildpacks Do for Me?

Cloud Native Buildpacks produce OCI-compliant containers without the need to create a Dockerfile. This is because they have an internal detect and build pipeline that packages the application on top of a base image provided by CNB.

This is convenient because it allows developers to focus on code rather than having to learn the intricacies of building a supported container image. (CNB can leverage an existing Dockerfile, but it is not required.) These containers can run on any of the major container runtime options that use Docker and Kubernetes, including containerd, podman, and CRI-O, meaning the image will run where you need it to – from hyperscale public clouds to small footprint deployments like k3s.

There are already dozens of buildpacks available across almost any language you need, and there are even buildpacks that automatically detect the language in which the application is written. As long as the application source code containers have defined their dependencies using the most popular tool for that language, CNB can then execute the build and create a container image. Out of the box, the pack CLI suggests six different buildpacks, most of which are based on Ubuntu Bionic 18.04:


As with any new technology, there are always limitations. The single biggest limitation of buildpacks is related to how you structure your application source code and what you use for dependency management. Since it is a prescriptive system, you have to follow the formula. This won’t work for all situations, but it will likely work for most. In most organizations, you’ll need to make decisions about updating your internal best practices and style guides to reflect the ways in which buildpacks require you to work.

The second limitation concerns customization. When working with Dockerfiles, developers and operators can essentially build a custom world to hold any application. This is often a popular option for digital transformation projects where applications are being migrated to containers with the goal of refactoring them to be more cloud native in the future. Buildpacks do allow for a degree of customization, but it’s probably better for greenfield development and smaller applications like microservices. I do not recommend trying to move large and complex applications to buildpacks until you are very comfortable with them.

A Quick Example of Going from Code to Container with CNB

The simplest example from the website consists of just three commands to go from cloning to building to running the app (assuming that you have pack, Git, and Docker installed):

# clone the repo
$ git clone

# build the app
$ pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic

# run the app
$ docker run --rm -p 8080:8080 sample-app

Note: Windows and Mac users (especially those on Silicon M1 devices) may need to investigate alternative builders or build strategies to get this example to work.

When the app is structured to work with CNB, the pack CLI quickly goes through its process, which is essentially the following three steps:

  1. The buildpack detects that the sample app is written in Java and uses Maven. Then, it sets up the appropriate build environment.
  2. Since the buildpack knows that this sample uses Maven, it knows how to resolve dependencies that the developer defined in the application’s pom.xml.
  3. Finally, it runs Maven to handle the build and package the application.

All of the dependencies and packages are added as layers on the CNB’s predefined base image, and then the final output is ready to run a container image. One nice thing about the layered approach is that each iterative build will only update the layers that were changed, which makes for faster builds and updates across both registries and each node when restarting the instances.


Cloud Native Buildpacks are a fantastic solution for helping developers start using containers without having to learn a whole new way of thinking – as long as they’re willing to follow the best practices. There’s no need to build complex pipelines or Dockerfiles for each project; instead, you just need to build an application with properly defined dependencies, and CNB will take care of the rest. It will produce a container image that operations can then deploy on essentially any container orchestration platform on any cloud or in any datacenter. It almost seems too good to be true.

Want to better understand how your buildpack–created container is built? Check out the Slim Developer Platform for free.

About the Author

Vince Power is an Enterprise Architect with a focus on digital transformation built with cloud enabled technologies. He has extensive experience working with Agile development organizations delivering their applications and services using DevOps principles including security controls, identity management, and test automation. You can find him at @vincepower on Twitter.

Related Articles

5 Most Commonly Asked DockerSlim Questions

We enlisted DockerSlim expert and Slim.AI Developer Experience Engineer to dive into how container slimming works.

Primož Ajdišek

Technical Staff

5 Ways Slim Containers Save You Money

Do slim containers really save you money on your cloud bill? Are there cost advantages to smaller containers? Find out here.

Chris Tozzi

Automating DockerSlim in Your CICD Pipeline

Using GitHub Actions, you can refine container images automatically making them smaller, faster to load, and more secure by default – all without sacrificing any capabilities.

Nicolas Bohorquez


Building DockerSlim into a Jenkins Pipeline

A step by step tutorial on building DockerSlim into your CI/CD pipeline.

Clarifying the Complex: Meet Ivan Velichko, Container Dude at Slim.AI

Ivan recently joined the team at Slim.AI, and we sat down with him to learn more about the path that led him here.

Ivan Velichko

Container Dude

Container Insights: Dissecting the World's Most Popular Containers

Join Ayse Kaya in this series, as she creates her 2022 Container Report Chalk Full of Important Security Findings for Developers.

Ayse Kaya

Analytics & Strategy

Container of the Week: Python & Flask

Our weekly breakdown of a popular container

What We Discovered Analyzing the Top 100 Public Container Images

Complexity abounds in modern development

Ayse Kaya

Analytics & Strategy

2022 Public Container Report

Vulnerabilities continue to increase and developers are struggling to keep up.

Ayse Kaya

Analytics & Strategy

Containerizing Python Apps for Lambda

A tutorial on deploying AWS Lambda using containers, Python edition.

Docker Containers for Your Raspberry Pi

Compact PCs need compact apps

Martin Wimpress


Explore and analyze a Docker container with DockerSlim X-Ray

Understanding container composition

Martin Wimpress


Five Proven Ways to Debug a Container

When Things Just Are Not Working

Theofanis Despoudis


Five Things You Should Never Ship to Production in a Container

Here is our take on five things to avoid when creating a container or shipping it to production.

Chris Tozzi

Increasing Your CI/CD Velocity with Slim Containers

We’ll explain what Slim Containers are, how they speed up the build process, and how they can improve the efficiency of your testing.

Mike Mackrory


Integrate Testing into Your Container Pipeline

A closer look at testing within container pipelines, CI/CD, software delivery, and containerization.

Faith Kilonzi

Software Engineer

Reducing Docker Image Size - Slimming vs Compressing

Know the difference

Pieter van Noordennen


Serverless Applications and Docker

How to Scale the Latest Trend in Infrastructure

Pieter van Noordennen


Slim.AI Docker Extension for Docker Desktop

How to access our Docker Extension and try it for yourself.

Josh Viney


Slimming a Rails Application with DockerSlim

Dissect a simple Rails application container using DockerSlim to analyze, optimize, and deploy your product more quickly.

Theofanis Despoudis


Where Do You Store Your Container Images?

Container Registry Options are Growing in Number and Complexity

Pieter van Noordennen


Using AppArmor and SecComp Profiles for Security Audits

Conduct better container security audits using tools like SecComp, NGINX, and Docker.

What’s in your container?

Why Docker Layers matter for container optimization

Pieter van Noordennen


Why Developers Shouldn't Have to Be Infrastructure Experts, Too

Simplifying processes required to containerize and deploy cloud-native apps.

Chris Tozzi

A New Workflow for Cloud Development

Leverage the benefits of containerization without the headaches & hassle

John Amaral


Why Don’t We Practice Container Best Practices?

Container best practices are easy to understand, hard to do

John Amaral


Better Security Audits with AppArmor and SecComp via DockerSlim

Combine the power of tools like SecComp, NGINX, and Docker.

Automatically reduce Docker container size using DockerSlim

REST Web Service example using Python/Flask

John Amaral


Comparing Container Versions with DockerSlim and Slim.AI

See differences between your original and slimmed images

Pieter van Noordennen


Getting Started with Multi-Container Apps

Up your container game with Docker Compose

Nicholas Bohorquez


Quick Start Guide

Slim Developer Platform Early Access

Meet DockerSlim's Compose Mode

Optimize a multi-tier app with a single command

Ian Juma

Technical Staff

Creating a Container Pipeline with GitLab CI

Shipping containers the easy way

Nicolas Bohorquez