Docker App is a new tool we spoke briefly about back at DockerCon US 2018. We’ve been working on `docker-app` to make container applications simpler to share and easier to manage across different teams and between different environments, and we open sourced it so you can already download Docker App from GitHub at https://github.com/docker/app.
In talking to others about problems they’ve experienced sharing and collaborating on the broad area we call “applications” we came to a realisation: it’s a more general problem that others have been working on too. That’s why we’re happy to collaborate with Microsoft on the new Cloud Native Application Bundle (CNAB) specification.
Today’s cloud native applications typically use different technologies, each with their own toolchain. Maybe you’re using ARM templates and Helm charts, or CloudFormation and Compose, or Terraform and Ansible. There is no single solution in the market for defining and packaging these multi-service, multi-format distributed applications.
CNAB is an open source, cloud-agnostic specification for packaging and running distributed applications that aims to solve some of these problems. CNAB unifies the management of multi-service, distributed applications across different toolchains into a single all-in-one packaging format.
The draft specification is available at cnab.io and we’re actively looking both for folks interested in contributing to the spec itself, and to people interested in building tools around the specification. The latest release of Docker App is one such tool that implements the current CNAB spec. That means it can be used to both build CNAB bundles for Compose (which can then be used with any other CNAB client), and also to install, upgrade and uninstall any other CNAB bundle.
Sharing CNAB bundles on Docker Hub
One of the limitations of standalone Compose files is that they cannot be shared on Docker Hub or Docker Trusted Registry. Docker App solves this issue too. Here’s a simple Docker application which launches a very simple Prometheus stack:
version: 0.1.0
name: monitoring
description: A basic prometheus stack
maintainers:
– name: Gareth Rushgrove
email: garethr@docker.com
—
version: ‘3.7’
services:
prometheus:
image: prom/prometheus:${versions.prometheus}
ports:
– ${ports.prometheus}:9090
alertmanager:
image: prom/alertmanager:${versions.alertmanager}
ports:
– ${ports.alertmanager}:9093
—
ports:
prometheus: 9090
alertmanager: 9093
versions:
prometheus: latest
alertmanager: latest
With that saved as `monitoring.dockerapp` we can now build a CNAB and share that on Docker Hub.
$ docker-app push –namespace <your-namespace>
Now on another machine we can still interact with the shared application. For instance let’s use the `inspect` command to get information about our application:
$ docker-app inspect <your-namespace>/monitoring:0.1.0
monitoring 0.1.0
Maintained by: Gareth Rushgrove <garethr@docker.com>
A basic prometheus stack
Services (2) Replicas Ports Image
———— ——– —– —–
prometheus 1 9090 prom/prometheus:latest
alertmanager 1 9093 prom/alertmanager:latest
Parameters (4) Value
————– —–
ports.alertmanager 9093
ports.prometheus 9090
versions.alertmanager latest
versions.prometheus latest
All the information from the Compose file is stored with the CNAB on Docker Hub, and if you notice, it’s also parameterized, so values can be substituted at runtime to fit the deployment requirements. We can install the application directly from Docker Hub as well:
docker-app install <your-namespace>/monitoring:0.1.0 –set ports.alertmanager=9095
Installing a Helm chart using Docker App
One question that has come up in the conversations we’ve had so far is how `docker-app` and now CNAB relates to Helm charts. The good news is that they all work great together! Here is an example using `docker-app` to install a CNAB bundle that packages a Helm chart. The following example uses the `hellohelm` example from the CNAB example bundles.
$ docker-app install -c local bundle.json
Do install for hellohelm
helm install –namespace hellohelm -n hellohelm /cnab/app/charts/alpine
NAME: hellohelm
LAST DEPLOYED: Wed Nov 28 13:58:22 2018
NAMESPACE: hellohelm
STATUS: DEPLOYED
RESOURCES:
==> v1/Pod
NAME AGE
hellohelm-alpine 0s
Next steps
If you’re interested in the technical details of the CNAB specification, either to see how it works under the hood or to maybe get involved in the specification work or building tools against it, you can find the spec at cnab.io.
If you’d like to get started building applications with Docker App you can download the latest release from github.com/docker/app and check out some of the examples provided in the repository.
#Docker App first tool to implement CNAB specClick To Tweet
The post Docker App and CNAB appeared first on Docker Blog.
Quelle: https://blog.docker.com/feed/
Published by