Making Application Collaboration Easier with Docker Application Packages



  • In the first blog post about the experimental Docker Application Packages, Gareth showed how our new open-source docker-app can be used to augment Compose files by adding metadata and separate settings.

    Now that you know how to create an Application Package, how do you share it? Using a Docker registry solution like Docker Hub or Docker Enterprise of course! Let’s look at an example that works with the latest release of docker-app. Here’s a simple single-file format Application Package with the filename hello.dockerapp:

    <pre style="text-align: left;"># This section contains your application metadata. version: 0.1.0 name: hello description: "A simple HTTP echo server" maintainers: - name: Chris Crone email: [email protected] targets: swarm: true kubernetes: true --- # This section contains the Compose file that describes your application services. version: '3.6' services: hello: image: hashicorp/http-echo:${version} command: ["-text", "${text}"] ports: - ${port}:5678 --- # This section contains the default values for your application settings. port: 5678 text: hello development version: latest</pre>

    We can save this Application Package as a Docker image using the save command:

    <pre style="text-align: left;">$ docker-app save Saved application as image: hello.dockerapp:0.1.0</pre>

    As stated in the above output, the application is simply a Docker image now. We can confirm the package was saved as an image by listing the Application Packages stored as images:

    <pre style="text-align: left;">$ docker image ls --filter=label=com.docker.application REPOSITORY TAG IMAGE ID CREATED SIZE hello.dockerapp 0.1.0 211d7b50537b 8 minutes ago 534B</pre>

    Note that the version of the image matches the version we specified in the package metadata. There is also a helper in docker-app to list all applications that you have stored as images:

    <pre style="text-align: left;">$ docker-app ls REPOSITORY TAG IMAGE ID CREATED SIZE hello.dockerapp 0.1.0 211d7b50537b 8 minutes ago 534B</pre>

    An Application Package stored as an image can be inspected just as one would any of the other package types:

    <pre style="text-align: left;">$ cd /tmp $ docker-app inspect hello.dockerapp:0.1.0 hello 0.1.0 Maintained by: Chris Crone [email protected] A simple HTTP echo server Setting Default ------- ------- port 5678 text hello development version latest</pre>

    Since this Application Package is stored as an image, you can share it using Docker Hub or a private Docker registry such as Docker Enterprise Edition:

    <pre style="text-align: left;">$ docker-app push --namespace ccrone The push refers to repository [docker.io/ccrone/hello.dockerapp] c3dd6b98b5be: Pushed 0.1.0: digest: sha256:0a94283fda704dcd316c600fb850783803d472384fff1a4a4c4c94c062dab696 size: 524</pre>

    Now that the package is on Docker Hub, it’s easy for other people to use it. For example they can render or deploy the package as they would the single-file or directory format:

    <pre style="text-align: left;">$ docker-app render ccrone/hello.dockerapp version: "3.6" services: hello: command: - -text - hello development image: hashicorp/http-echo:latest ports: - mode: ingress target: 5678 published: 5678 protocol: tcp</pre>

    Status?

    The work on Application Packages and docker-app is experimental. We released it early to get your feedback. You can find the source code at https://github.com/docker/app or you can download docker-app from https://github.com/docker/app/releases.


    Latest release of open-source docker-app now supports sharing Docker Application Packages
    Click To Tweet


    Next Steps:

    The post Making Application Collaboration Easier with Docker Application Packages appeared first on Docker Blog.

    https://blog.docker.com/2018/07/making-application-collaboration-easier-docker-application-packages/



© Lightnetics 2024