Deploying Applications to the Docker Ecosystem - SVCC (Saturday) 2015

Deploying Applications to the Docker Ecosystem - SVCC (Saturday) 2015

Slides from the Saturday version of my talk at the Silicon Valley Code Camp. Has extra slides with links to some more details.


Ted M. Young

October 03, 2015


  1. Ted M. Young @jitterted Deploying Applications in the

    Docker Ecosystem
  2. Ted M. Young @jitterted Thank you for attending

    my talk, I hope that you learned something worthy of your time. Interested in learning more? Contact me about my upcoming on-line video learning course that goes into much more depth, and walks you through creating and deploying scalable applications. If you need help incorporating the Docker Ecosystem into your applications or Continuous Integration system, I am available for training and consulting.
  3. Ted M. Young @jitterted Here are some links

    to things I mentioned during my talk (missed something? Contact me!): Linux OSes to use for Docker Hosting: * CoreOS (ships with Docker and other tools): * Ubuntu (14.04 or later) Distributed/High-Availability Configuration tools * Apache Zookeeper: * etcd (CoreOS): Docker Container Hosting in the Cloud (just a sampling!): * Google Container Engine: * Amazon EC2 Container Service: * Tutum: * Joyent:
  4. What do we know?

  5. It's a Container * obligatory container picture

  6. Runs natively only on Linux Soon: FreeBSD, Solaris, Windows Server

    Not OS X
  7. Terms Some Definitions…

  8. Image packaged filesystem $ docker images

  9. None
  10. None
  11. Image Registry source of images $ docker pull registry/image:tag

  12. Get images from the registry and run them command-line demo

  13. Container process(es) (running or not) $ docker ps [-a]

  14. Processes are running in memory

  15. Processes are gone, memory state lost

  16. Containers provide Isolation

  17.  File system  Process  Network  Memory all

    are isolated
  18.  File system  Process  Network  Memory constrained

  19. Environment Isolation

  20. Environment Stability

  21. Want Node.js version 0.10.38?

  22. Also version 0.12.2?

  23. On the SAME machine?

  24. $ docker run node:0.10.38 $ docker run node:0.12.2 done.

  25. VM vs. Container

  26. Package once… Run everywhere

  27. An Image ready-to-run packaged file system $ docker run ...

  28. Let someone else build and I'll run it

  29. Before Dockerization

  30. Running Doc Generator Tool • Make sure you have Python

     And make sure it's Python 2.7  No, not Python 3, it needs 2.7 • Install pip  $ python  Did it work? • Install sphinx  $ pip install sphinx  argh…
  31. After Dockerization

  32. Running Doc Generator Tool $ docker run -v /mydocpath:/doc \

    minimum2scp/sphinx \ "cd /doc; make html"
  33. Use of Image Registry

  34. Creating images Dockerfile

  35. FROM nginx:1.7 MAINTAINER Ted M. Young "" RUN rm /etc/nginx/nginx.conf

    /etc/nginx/mime.types \ && mkdir /etc/nginx/ssl COPY nginx.conf /etc/nginx/nginx.conf COPY mime.types /etc/nginx/mime.types COPY default /etc/nginx/sites-enabled/default COPY default-ssl /etc/nginx/sites-available/default-ssl # This will add the expanded tar file ADD www.tar /var/www EXPOSE 80 443 VOLUME /var/log/nginx CMD ["nginx"]
  36. Build the image command-line demo

  37. Standing on the [images] of giants

  38. FROM mongo:2.6 ADD init-mongo.js /usr/local/bin/init-mongo.js # Define working directory (where

    commands below will be executed) WORKDIR /usr/local/bin ENTRYPOINT ["mongo"] CMD ["--host", "mongodb", "init-mongo.js"]
  39. FROM debian:wheezy # add our user and group first to

    make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mongodb && useradd -r -g mongodb mongodb RUN apt-get update \ && apt-get install -y curl numactl \ && rm -rf /var/lib/apt/lists/* # grab gosu for easy step-down from root RUN gpg --keyserver --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 RUN curl -o /usr/local/bin/gosu -SL "$(dpkg --print-architecture)" \ && curl -o /usr/local/bin/gosu.asc -SL "$(dpkg --print-architecture).asc" \ && gpg --verify /usr/local/bin/gosu.asc \ && rm /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu ENV MONGO_RELEASE_FINGERPRINT DFFA3DCF326E302C4787673A01C4E7FAAAB2461C RUN gpg --keyserver --recv-keys $MONGO_RELEASE_FINGERPRINT ENV MONGO_VERSION 2.6.9 RUN curl -SL "$MONGO_VERSION.tgz" -o mongo.tgz \ && curl -SL "$MONGO_VERSION.tgz.sig" -o mongo.tgz.sig \ && gpg --verify mongo.tgz.sig \ && tar -xvf mongo.tgz -C /usr/local --strip-components=1 \ && rm mongo.tgz* VOLUME /data/db COPY / ENTRYPOINT ["/"] EXPOSE 27017 CMD ["mongod"]
  40. Pushing images to the registry

  41. Image tag naming [registry/][owner/]name[:version] mongo mongo:2.6 mongo:latest 19hz/mongo-container private-registry/tyoung/mongodb:0.3.0

  42. Pushing images to the registry $ docker push image_name

  43. What Makes an Application?

  44. None
  45. Apps Don't Stand Alone Scaling Deployments

  46. network link network link

  47. shared namespace

  48. None
  49. None
  50. None
  51. docker-compose Static Deployment

  52. nginx: image: nginx:latest links: apiservice apiservice: image: api-service:latest links: -

    logstash - redis - postgres - elastic logstash: image: logstash:latest links: - apiservice elastic: image: elasticsearch:latest postgres: image: … docker-compose.yml
  53. Bring up the containers $ docker-compose up -d

  54. Bring up the containers $ docker-compose up -d

  55. On one machine?

  56. Multiple Nodes?

  57. None
  58. None
  59. None
  60. Container Deployment Dynamic

  61. Cluster Management • Resource Manager • Job/Task Scheduler

  62. Resource Manager • Tracks state of  Node (host machine)

     CPU  RAM  Storage • Fulfills requests
  63. Scheduler • Assigns workloads to machines • Decides which task/job/thing

    to start • When to start it • When to stop/kill it
  64. Mesos: Meta Scheduler

  65. Marathon Distributed "initd"

  66. Mesos: Meta Scheduler

  67. Google Kubernetes (Greek for "helmsman")

  68. Lessons from Borg and Omega

  69. API service log forwarder service monitor attached storage Pod: Unit

    of Placement
  70. Node

  71. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time"
  72. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Too many? Kill it.
  73. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Too many? Kill it. •Too few? Start some.
  74. Replication Controller "ensures that a specified number of pod 'replicas'

    are running at any one time" •Too many? Kill it. •Too few? Start some. •Failured? Start more.
  75. None
  76. Service: Access to Pods

  77. None
  78. Final Questions?

  79. Thanks! Happy to chat more about Docker anytime.

  80. the end @jitterted