Cloud Native Developer workflows for Docker

Cloud Native Developer workflows for Docker

A talk from DockerCon EU 2018 about software development building blocks with Docker, how they are linked together into workflows, and various new tools aimed at reducing developer friction.

98234c645fe8c935edc0fec0186d28b8?s=128

Gareth Rushgrove

December 05, 2018
Tweet

Transcript

  1. GARETH RUSHGROVE Product Manager, Docker Cloud-Native Developer Workflows for Docker

    Applications
  2. - The building blocks for Docker applications - What we

    mean by developer workflow - Reducing developer friction - Lots of demos What we’ll cover
  3. The Docker fundamentals Building Blocks

  4. Docker Desktop - Docker and Kubernetes on your local machine

    - Easy to install and easy to manage
  5. - Describe the steps to build a Docker image -

    More than 1.1m Dockerfiles public on GitHub Dockerfile # We name the `base` stage so we can reference it in multiple later # stages but only need to update it in one place if we change it FROM python:3-alpine AS base WORKDIR /app RUN pip install pipenv==2018.10.13 COPY Pipfile /app/ COPY Pipfile.lock /app/ RUN pipenv install --system --deploy # The `app` stage is used as the base for images that don't # need the development dependencies FROM base AS app COPY src /app # The `test-base` stage is used as the base for images that require # the development dependencies. FROM base AS test-base
  6. Compose and Kubernetes config - Describe the components of your

    multi-service application in code version: '3.7' services: sensu-backend: image: sensu/sensu:latest command: sensu-backend start hostname: sensu-backend ports: - 3000:3000 - 8080:8080 sensu-agent: image: sensu/sensu:latest command: sensu-agent start --backend-url ws://sensu-backend:8081 depends_on: - sensu-backend deploy: replicas: 4
  7. Your source code - The most important part. Your application.

    export default () => ( <div> Hello world <p>scoped!</p> <style jsx>{` p { color: blue; } div { background: red; } @media (max-width: 600px) { div { background: blue; } } `}</style>
  8. How we use our tools together Workflow

  9. workflow Noun the sequence of industrial, administrative, or other processes

    through which a piece of work passes from initiation to completion.
  10. The hard way - Just use the low-level tools -

    Workflow is by memory, or maybe documentation if you’re lucky $ kubectl run --image hello-dockercon:1 hello --port=8080 deployment.apps "hello" created $ kubectl get deployment hello -o json { "apiVersion": "extensions/v1beta1", "kind": "Deployment", "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1" }, "creationTimestamp": "2018-11-26T12:42:53Z", "generation": 1, "labels": { "run": "hello" }, "name": "hello", "namespace": "default",
  11. Pick and mix - Wrap everything in a Makefile (or

    similar) - Introduce other tools $ make do-everything
  12. From within an IDE - Integrated functionality in your editor

    - Customisation via plugins $ cat spec.txt Cloud Native Application Bundle Core 1.0.0 (CNAB1) Working Draft, Nov. 2018 Cloud Native Application Bundles (CNAB) are a standard packaging format for multi-component distributed applications. It allows packages to target different runtimes and architectures. It empowers application distributors to package applications for deployment on a wide variety of cloud platforms, cloud providers, and cloud services. It also provides the capabilities necessary for delivering multi-container applications in disconnected environments. CNAB is not a platform-specific tool. While it uses
  13. The same fundamentals - Writing code - Testing code -

    Building artefacts - Running code
  14. Working with others Team Workflow

  15. Source control - Share code and changes with other people

  16. Continuous integration - Ensure you always have a working, integrated

    version of your software
  17. Docker registry - Store your artefacts centrally - Avoid the

    need to constantly rebuild and retest
  18. The same fundamentals - Writing code - Testing code -

    Building artefacts - Running code
  19. Time for a few demos Reducing Developer Friction

  20. friction Noun the resistance that one surface or object encounters

    when moving over another.
  21. friction Noun conflict or animosity caused by a clash of

    wills, temperaments, or opinions.
  22. developer friction Made up concept the resistance that a developer

    encounters when trying to do their job
  23. friction Noun ...the energy lost to friction is turned into

    sound and heat.
  24. So how can we reduce the friction when it comes

    to developer workflow?
  25. Demo time

  26. If all you remember is... Conclusions

  27. Build - Multi-stage builds can reduce the need for scripts

    - New tools like docker assemble reduce the need for configuration at all $ docker fab build . [+] Building 8.2s (13/16) => local://project (docker-hlb.yaml) => => transferring project: 2B => local://project (*.[fc]sproj) => => transferring project: 2B => local://project (pom.xml) => => transferring project: 29B => resolve image config for docker.io/library/maven:3-jdk-10-slim => resolve image config for docker.io/docker/dockerfile-copy:v0.1.8 => resolve image config for docker.io/library/openjdk:10-jre-slim => runtime image => => resolve docker.io/library/openjdk:10-jre-slim@sha25 => => sha256:7e9a9557c5738bcf45787bbc6bf5fff60f06562c2ddb
  28. Inner-loop development - Change code or configuration, automatically rebuild images

    and run application locally $ cat skaffold.yaml apiVersion: skaffold/v1alpha5 kind: Config build: tagPolicy: sha256: {} artifacts: - image: garethr/skaffold-example local: useBuildkit: true deploy: kubectl: manifests: - stack.yaml
  29. Testing - Fast feedback - Share tests between applications to

    help enforce organisational policy $ cat .github/main.workflow action "test" { uses = "actions/docker/cli@master" args = "build --target test ." } action "security" { uses = "actions/docker/cli@master" secrets = ["MICROSCANNER"] args = "build --target security --build-arg MICROSCANNER } action "lint" { uses = "actions/docker/cli@master" args = "run -i hadolint/hadolint hadolint - <Dockerfile" }
  30. Packaging multi-service applications - Share applications with others easily with

    docker app - Reduce operator friction by defining clear interfaces $ docker-app install garethr/myapp Waiting for the stack to be stable and running... service1: Ready service2: Ready mysql: Ready Stack hello is stable and running
  31. - Always be looking for ways to reduce developer friction

    - Improvements might be incremental, or they might be revolutionary - Composable tools are one honking great idea, let's do more of those! In summary
  32. Take A Breakout Survey Access your session and/or workshop surveys

    for the conference at any time by tapping the Sessions link on the navigation menu or block on the home screen. Find the session/workshop you attended and tap on it to view the session details. On this page, you will find a link to the survey.
  33. https://dockr.ly/Forrester Get the Forrester Report on Container Platforms For more

    information visit:
  34. Come Join Us In San Francisco April 29-May 2 2019

  35. Thanks And any questions?