{"id":833,"date":"2018-12-06T23:09:41","date_gmt":"2018-12-06T23:09:41","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=833"},"modified":"2018-12-06T23:50:34","modified_gmt":"2018-12-06T23:50:34","slug":"docker-app-and-cnab-docker-blog","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/06\/docker-app-and-cnab-docker-blog\/","title":{"rendered":"Docker App and CNAB &#8211; Docker Blog"},"content":{"rendered":"<p>Docker App is a new tool we spoke briefly about <a href=\"https:\/\/blog.docker.com\/2018\/06\/compose-easier-to-use-with-application-packages\/\">back at DockerCon US 2018<\/a>. We\u2019ve 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 <a href=\"https:\/\/github.com\/docker\/app\">https:\/\/github.com\/docker\/app<\/a>.<\/p>\n<p>In talking to others about problems they\u2019ve experienced sharing and collaborating on the broad area we call \u201capplications\u201d we came to a realisation: it\u2019s a more general problem that others have been working on too. That\u2019s why we\u2019re happy to collaborate with Microsoft on the new <a href=\"https:\/\/cnab.io\/\"><b><i>Cloud Native Application Bundle <\/i><\/b>(CNAB) specification<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i1.wp.com\/blog.docker.com\/wp-content\/uploads\/2018\/12\/MultiService-Distributed-Apps.png?resize=367%2C332&amp;ssl=1\" alt=\"Multi-Service Distributed Applications\" width=\"367\" height=\"332\" \/><\/p>\n<p>Today\u2019s cloud native applications typically use different technologies, each with their own toolchain. Maybe you\u2019re 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.<\/p>\n<p>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.<\/p>\n<p>The draft specification is available at <a href=\"https:\/\/cnab.io\/\">cnab.io<\/a> and we\u2019re 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.<\/p>\n<h3><b>Sharing CNAB bundles on Docker Hub<\/b><\/h3>\n<p>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\u2019s a simple Docker application which launches a very simple Prometheus stack:<\/p>\n<p>version: 0.1.0<br \/>\nname: monitoring<br \/>\ndescription: A basic prometheus stack<br \/>\nmaintainers:<br \/>\n&#8211; name: Gareth Rushgrove<br \/>\nemail: garethr@docker.com<br \/>\n&#8212;<br \/>\nversion: &#8216;3.7&#8217;<\/p>\n<p>services:<br \/>\nprometheus:<br \/>\nimage: prom\/prometheus:$<br \/>\nports:<br \/>\n&#8211; $:9090<\/p>\n<p>alertmanager:<br \/>\nimage: prom\/alertmanager:$<br \/>\nports:<br \/>\n&#8211; $:9093<br \/>\n&#8212;<\/p>\n<p>ports:<br \/>\nprometheus: 9090<br \/>\nalertmanager: 9093<br \/>\nversions:<br \/>\nprometheus: latest<br \/>\nalertmanager: latest<\/p>\n<p>With that saved as `monitoring.dockerapp` we can now build a CNAB and share that on Docker Hub.<\/p>\n<p>$ docker-app push &#8211;namespace &lt;your-namespace&gt;<\/p>\n<p>Now on another machine we can still interact with the shared application. For instance let\u2019s use the `inspect` command to get information about our application:<\/p>\n<p>$ docker-app inspect &lt;your-namespace&gt;\/monitoring:0.1.0<br \/>\nmonitoring 0.1.0<\/p>\n<p>Maintained by: Gareth Rushgrove &lt;garethr@docker.com&gt;<\/p>\n<p>A basic prometheus stack<\/p>\n<p>Services (2) Replicas Ports Image<br \/>\n&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8211; &#8212;&#8211;<br \/>\nprometheus 1 9090 prom\/prometheus:latest<br \/>\nalertmanager 1 9093 prom\/alertmanager:latest<\/p>\n<p>Parameters (4) Value<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8211;<br \/>\nports.alertmanager 9093<br \/>\nports.prometheus 9090<br \/>\nversions.alertmanager latest<br \/>\nversions.prometheus latest<\/p>\n<p>All the information from the Compose file is stored with the CNAB on Docker Hub, and if you notice, it\u2019s 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:<\/p>\n<p>docker-app install &lt;your-namespace&gt;\/monitoring:0.1.0 &#8211;set ports.alertmanager=9095<\/p>\n<h3><b>Installing a Helm chart using Docker App<\/b><\/h3>\n<p>One question that has come up in the conversations we\u2019ve 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.<\/p>\n<p>$ docker-app install -c local bundle.json<br \/>\nDo install for hellohelm<br \/>\nhelm install &#8211;namespace hellohelm -n hellohelm \/cnab\/app\/charts\/alpine<br \/>\nNAME: hellohelm<br \/>\nLAST DEPLOYED: Wed Nov 28 13:58:22 2018<br \/>\nNAMESPACE: hellohelm<br \/>\nSTATUS: DEPLOYED<\/p>\n<p>RESOURCES:<br \/>\n==&gt; v1\/Pod<br \/>\nNAME AGE<br \/>\nhellohelm-alpine 0s<\/p>\n<h3><b>Next steps<\/b><\/h3>\n<p>If you\u2019re 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 <a href=\"https:\/\/cnab.io\/\">cnab.io<\/a>.<\/p>\n<p>If you\u2019d like to get started building applications with Docker App you can download the latest release from <a href=\"https:\/\/github.com\/docker\/app\">github.com\/docker\/app<\/a> and check out some of the examples provided in the repository.<br \/>\n<a href=\"https:\/\/blog.docker.com\/2018\/12\/docker-app-and-cnab\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker App is a new tool we spoke briefly about back at DockerCon US 2018. We\u2019ve 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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/12\/06\/docker-app-and-cnab-docker-blog\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Docker App and CNAB &#8211; Docker Blog&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-833","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/833","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=833"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/833\/revisions"}],"predecessor-version":[{"id":874,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/833\/revisions\/874"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}