Multi-container applications

Tomáš Tomeček

Recap

  1. What is a linux container?
  2. Do you store persistent data in a container?
  3. Can I control resources for containers?
  4. How do I set some environment variables inside container?

Single-container app

Static web-page.

$ docker run -d -p 1313:1313 -t lgsd/docker-hugo
          

Single-container app

  • Can be run with a single command.
  • Storage is easy.
  • Networking within a single host.
  • Management can be manual.
  • Monitoring (one process).
  • Zero-downtime upgrades should be easily possible.

Multi-container app

  • Web.
  • Database.
  • In-memory database.
  • Worker.

Multi-container app

  • It takes several commands to start all services.
  • Start order matters.
  • Storage is hard.
  • Networking is harder.
  • Services may not run on the same host.
  • Services may not run in the same cluster.
  • Services may not run in the same data center.
  • Services may not run in the same region.
  • Oh my! How do I manage this?
  • ...and how do I monitor it?!
  • I wish we had zero-downtime upgrades.

Orchestration

  • Application definition
  • Storage
  • Networking (PaaS)
  • Management
  • Service discovery (PaaS)
  • Content?

Application definition

  • Image
  • Ports
  • Volumes
  • Environment variables
  • Security (users, permissions, capabilities)

Container content

  • How do I create my image?
  • Support
  • Security updates

Storage

  • Volumes
  • Volume types

Management

  • How do I get images?
  • How do I deploy?
  • How do I update?
  • How do I scale?

Multi-container tools

  • kubernetes
  • docker-compose
  • ansible-container

docker-compose

version: '2'
services:
  web:
    build: .
    ports:
    - "5000:5000"
    volumes:
    - .:/code
    - data_volume:/data
    links:
    - redis
  redis:
    image: redis
volumes:
  data_volume: {}
          

Demo

https://github.com/TomasTomecek/open-house-2016-demo