Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker from basics to orchestration (PHPConfBr2015)

Docker from basics to orchestration (PHPConfBr2015)

Talk given at PHP conference Brasil 2015 about Docker

Wellington F. Silva

December 03, 2015
Tweet

More Decks by Wellington F. Silva

Other Decks in Technology

Transcript

  1. Credits Special thanks to all the people who made and

    released these awesome resources for free: ◎ Presentation template by SlidesCarnival ◎ Photographs by Unsplash & Death to the Stock Photo (license) ◎ Dark wood background by The pattern library
  2. Overview ◎ Environment Issues ◎ Virtualization ◎ LXC ◎ Docker

    ◦ features ◦ demo ◎ Machine ◎ Orchestration ◦ tools ◦ demo ◎ Swarm ◦ demo ◎ Q&A
  3. Environment Issues ◎ substr vs mb_substr functions ◎ short open

    tags: <?= ◎ syntax changes between versions: array(); e [];
  4. Environment Issues ◎ substr vs mb_substr functions ◎ short open

    tags: <?= ◎ syntax changes between versions: array(); e []; ◎ extensions that we forget to install in production: php-memcached, redis, amqp, etc.
  5. Environment Issues ◎ substr vs mb_substr functions ◎ short open

    tags: <?= ◎ syntax changes between versions: array(); e []; ◎ extensions that we forget to install in production: php-memcached, redis, amqp, etc. ◎ different upload file settings in different servers
  6. ◎ 1960 - inspired by cpu time sharing ◎ IBM

    370 - First instructions to support software virtualization, CP/CMS allow running more than one instance simultaneously Virtualization - History
  7. ◎ 1960 - inspired by cpu time sharing ◎ IBM

    370 - First instructions to support software virtualization, CP/CMS allow running more than one instance simultaneously ◎ IBM z/VM - First success case, all hardware were virtualized Virtualization - History
  8. ◎ 1960 - inspired by cpu time sharing ◎ IBM

    370 - First instructions to support software virtualization, CP/CMS allow running more than one instance simultaneously ◎ IBM z/VM - First success case, all hardware were virtualized ◎ until nineties only client/server applications Virtualization - History
  9. ◎ 1960 - inspired by cpu time sharing ◎ IBM

    370 - First instructions to support software virtualization, CP/CMS allow running more than one instance simultaneously ◎ IBM z/VM - First success case, all hardware were virtualized ◎ until nineties only client/server applications ◎ 2000+ - CPUs with virtualization support, hypervisors: VMWare, Xen, KVM, VirtualBox, etc Virtualization - History
  10. ◎ Standard environment ◎ Improve resources utilization ◎ Easy data

    recovery ◎ If host fails all VMs crashes together Virtualization - Pros & Cons
  11. ◎ Standard environment ◎ Improve resources utilization ◎ Easy data

    recovery Virtualization - Pros & Cons ◎ If host fails all VMs crashes together ◎ Troubleshooting more difficult
  12. ◎ Standard environment ◎ Improve resources utilization ◎ Easy data

    recovery Virtualization - Pros & Cons ◎ If host fails all VMs crashes together ◎ Troubleshooting more difficult ◎ Increase overhead
  13. LXC - Linux Containers ◎ Exists since Jul/2008 - Kernel

    2.6.26+ ◎ Process isolation ◎ Network isolation
  14. LXC - Linux Containers ◎ Exists since Jul/2008 - Kernel

    2.6.26+ ◎ Process isolation ◎ Network isolation ◎ Memory limitation
  15. LXC - Linux Containers ◎ Exists since Jul/2008 - Kernel

    2.6.26+ ◎ Process isolation ◎ Network isolation ◎ Memory limitation ◎ File system isolation
  16. LXC - Pros & Cons ◎ Good resources isolation ◎

    Run as a process, a single PID is created
  17. LXC - Pros & Cons ◎ Good resources isolation ◎

    Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel)
  18. LXC - Pros & Cons ◎ Good resources isolation ◎

    Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel) ◎ Starts much more faster than VMs
  19. LXC - Pros & Cons ◎ Volume share are difficult

    to do ◎ Good resources isolation ◎ Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel) ◎ Starts much more faster than VMs
  20. LXC - Pros & Cons ◎ Volume share are difficult

    to do ◎ Architecture failure may lead to chroot attack ◎ Good resources isolation ◎ Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel) ◎ Starts much more faster than VMs
  21. LXC - Pros & Cons ◎ Volume share are difficult

    to do ◎ Architecture failure may lead to chroot attack ◎ IO overhead ◎ Good resources isolation ◎ Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel) ◎ Starts much more faster than VMs
  22. LXC - Pros & Cons ◎ Volume share are difficult

    to do ◎ Architecture failure may lead to chroot attack ◎ IO overhead ◎ Run on Linux hosts only ◎ Good resources isolation ◎ Run as a process, a single PID is created ◎ Reuse host resources (libs, kernel) ◎ Starts much more faster than VMs
  23. ◎ Portable ◎ Versionable ◎ Reusable ◎ Copy-on-write ◎ Logging

    ◎ Image change management Docker - Features
  24. ◎ Portable ◎ Versionable ◎ Reusable ◎ Copy-on-write ◎ Logging

    ◎ Image change management ◎ Automatic build Docker - Features
  25. ◎ Portable ◎ Versionable ◎ Reusable ◎ Copy-on-write ◎ Logging

    ◎ Image change management ◎ Automatic build ◎ Easy to share Docker - Features
  26. Docker - Features ◎ Private and public registry ◎ Server-client

    architecture ◎ Client consume engine API
  27. Docker - Features ◎ Private and public registry ◎ Server-client

    architecture ◎ Client consume engine API ◎ Orchestration tools (compose, swarm,volume networks)
  28. Docker - Features ◎ Private and public registry ◎ Server-client

    architecture ◎ Client consume engine API ◎ Orchestration tools (compose, swarm,volume networks) ◎ Always innovating
  29. Docker - Quick Tips ◎ It is a container not

    a VM ◎ Container images are like VM boxes
  30. Docker - Quick Tips ◎ It is a container not

    a VM ◎ Container images are like VM boxes ◎ Images are state, container runs it
  31. Docker - Install ◎ Follow instructions for your OS in

    http://docs. docker.com/installation
  32. Docker - Install ◎ Follow instructions for your OS in

    http://docs. docker.com/installation ◎ Several distros supported
  33. Docker - Install ◎ Follow instructions for your OS in

    http://docs. docker.com/installation ◎ Several distros supported ◎ Mac OS X and Windows needs a VM to act like a Docker host - Boot2docker
  34. Docker - Install ◎ Follow instructions for your OS in

    http://docs. docker.com/installation ◎ Several distros supported ◎ Mac OS X and Windows needs a VM to act like a Docker host - Boot2docker ◎ There is roadmap to run Linux container on FreeBSD host
  35. Docker - Install ◎ Follow instructions for your OS in

    http://docs. docker.com/installation ◎ Several distros supported ◎ Mac OS X and Windows needs a VM to act like a Docker host - Boot2docker ◎ There is roadmap to run Linux container on FreeBSD host ◎ Windows containers running on Windows hosts will be available on Windows Server 2016
  36. Docker - Beggining ◎ run ◎ pull ◎ commit ◎

    push ◎ exec ◎ ps ◎ images ◎ inspect ◎ rm ◎ rmi
  37. Docker - Improving ◎ Volume ◦ list, create, inspect ◎

    Port expose and port mapping ◎ Links between containers ◎ Network ◦ list, create,inspect, connect
  38. Docker - Machine ◎ Creates virtual machines ready to run

    docker locally or on the cloud. ◎ drivers available: ◦ Amazon Web Services, Microsoft Azure, Digital Ocean, Exoscale, Google Compute Engine, Microsoft Hyper-V, OpenStack, Rackspace, IBM Softlayer, Oracle VirtualBox, VMware vCloud Air, VMware Fusion, VMware vSphere and Generic
  39. Docker - Orchestration ◎ Docker Compose (Old FIG) ◦ Config

    file: docker-compose.yml ◦ Run: docker-compose up
  40. Docker - Orchestration ◎ Docker Compose (Old FIG) ◦ Config

    file: docker-compose.yml ◦ Run: docker-compose up ◎ Crane - http://getcrane.com ◦ Config file: crane.json or crane.yaml ◦ Run: crane lift
  41. Docker - Orchestration ◎ Docker Compose (Old FIG) ◦ Config

    file: docker-compose.yml ◦ Run: docker-compose up ◎ Crane - http://getcrane.com ◦ Config file: crane.json or crane.yaml ◦ Run: crane lift ◎ AZK - http://www.azk.io ◦ Config file: Azkfile.js ◦ Run: `azk agent start` and then `azk start`
  42. Docker - Orchestration ◎ Docker Swarm ◦ Orchestrate docker hosts

    ◦ supports schedulers and node discovery services
  43. Docker - Comming ◎ User namespaces ◎ Open Containers Initiative

    - by Linux Foundation: https://www.opencontainers.org/