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:
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:
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.
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!