Cloud Native Application Bundle — a spec for packaging distributed apps

Cloud Native Application Bundle (short CNAB) is a new specification for packaging distributed container-native applications. CNAB was designed by Docker, Microsoft, bitnami and Hashicorp. It facilitates the bundling, installing and managing of container-native apps and their coupled services.

A CNAB can be used to define whatever service or infrastructure. There are no limitations. Think about Containers managed with Compose, Helm, Kubernetes or Virtual Machines managed with Ansible or Terraform on any Platform or any on-premises environment. Just to mention a few possible options. A CNAB contains all needed information and resources and can, therefore, be easily shared and distributed.

Some more details

A CNAB contains a bundle definition file (bundle.json) to define the application/service and an invocation image to install it.

The bundle.json contains information like the name, version and description as well as information about the invocation images. It can also store the list of the used images, parameters and credentials if needed by the application.

In this example, CNAB is used to manage a Wordpress installation with Docker Compose. The bundle.json looks like the following:

{
"name": "compose",
"version": "0.1.0",
"invocationImages": [
{
"imageType": "docker",
"image": "cnab/compose:latest"
}
],
"images": [
{
"imageType": "docker",
"image": "wordpress:4.9.8-apache",
"digest": "sha256:7121cdf8e9f01816653a3b2d2f4fc7bfe1dab956f00db5c7e7689e5f1454029a"
},
{
"imageType": "docker",
"image": "mysql:5.7",
"digest": "sha256:1d8f471c7e2929ee1e2bfbc1d16fc8afccd2e070afed24805487e726ce601a6d"
}
],
"parameters": {},
"credentials": {}
}

The invocation image is used to install, update and manage the service. In this example the Image is called cnab/compose:latest. Its definition is also part of the CNAB and is stored in a folder called “cnab” next to the bundle.json. The folder structure of this example looks like this:

cnab/                  
└── build/
│ └──Dockerfile​
└── app​
├── Makefile
├── docker-compose.yml

In our example, the invocation image will be used to execute the docker-compose.yml to install, upgrade or uninstall the application. You can have a look into the Dockerfile as well as the other ones here.

The whole CNAB specification with much more details is available here. You will find some more example CNABs here.

As mentioned above CNAB is a specification, not a tool. That’s why Microsoft and Docker also built a CLI called Duffle to easily manage and use CNABs. Duffle can be used to create, manage and deploy CNABs. Beside this, Docker also extended their docker-app CLI to support the CNAB specification. docker-app can not only be used to manage and deploy CNABs but also to push (and therefore share them) to Docker Hub. Those two clients are a good starting point but hopefully there will be other implementations and integrations soon!

Introducing Cloud Native Application Bundle by
Microsoft Visual Studio