Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker introduction

228 views

Published on

Introduction about Docker

Published in: Software
  • Be the first to comment

Docker introduction

  1. 1. Docker Introduction github.com/phucnguyenvn
  2. 2. Agenda 1. Story 2. What is Docker LinuX Container (LXC) Docker Image Docker Container Docker Architecture & Basic command Linking & Expose Volume Dockerfile 3. Demo 4. Docker advantages
  3. 3. The situation we deploy PHP Projects! that we feel HURT
  4. 4. PHP Version Requirement Yii CodeIgniter DokuWiki Drupal 6 Wordpress There are so many PHP Projects.. Phalcon Symfony Drupal 7 MediaWiki Laravel Joomla Drupal 8
  5. 5. PHP Version Requirement Yii 5.1+ CodeIgniter 5.1.6+ DokuWiki 5.2 Drupal 6 5.2.x Wordpress 5.2.4+ But version requirement are different!? Phalcon 5.3+ Symfony 5.3.3+ Drupal 7 5.2.5+ MediaWiki 5.3.2+ Laravel 5.4+ Joomla 5.4+ Drupal 8 5.4+
  6. 6. WHICH PHP VERSION SHOULD I INSTALLED? Yii 5.1+ CodeIgniter 5.1.6+ DokuWiki 5.2 Drupal 6 5.2.x Wordpress 5.2.4+ But version requirement are different!? Phalcon 5.3+ Symfony 5.3.3+ Drupal 7 5.2.5+ MediaWiki 5.3.2+ Laravel 5.4+ Joomla 5.4+ Drupal 8 5.4+
  7. 7. Multifarious Extension apxs2, bcmath, bz2, calendar, cgi, cli, ctype, dba, debug, dom, embed, exif, fileinfo, filter, fpm, ftp, gcov, gd, gettext, hash, iconv, icu, imap, intl, ipc, ipv6, json, kerberos, mbregex, mbstring, mcrypt, mhash, mysql, openssl, pcntl, pcre, pdo, pgsql, phar, posix, readline, session, soap, sockets, sqlite, tidy, tokenizer, xml_all, xmlrpc, zip, zlib
  8. 8. One server – multi projects SERVER App 1 App 2 App n.......
  9. 9. One server – multi projects SERVER App 1 App 2 App n....... BUT DIFFERENT REQUIREMENT
  10. 10. How to solve problems?
  11. 11. That awesome! But may it be more lightweight?
  12. 12. The Challenge
  13. 13. The Matrix from Hell
  14. 14. Cargo Transport Pre-1960
  15. 15. Also a Matrix from Hell
  16. 16. Solution: Intermodal Shipping Container
  17. 17. Docker is a Container System for Code
  18. 18. Docker Eliminates the Matrix from Hell
  19. 19. Docker Eliminates the Matrix from Hell
  20. 20. Docker Trends
  21. 21. What is LXC? • LinuX Containers • Available since kernel 2.6.27 • Lightweight VM • own process space • own network interface • SHARE kernel with host • Run Linux within Linux
  22. 22. Why Docker Containers Lightweight?
  23. 23. Docker Image • Read Only • Don’t change • Envionments • Used to be container
  24. 24. Docker Container • ReadWrite Layer • Running Process • Build with one or more images • Commit change to create image
  25. 25. Relationship between image and container Image (registry) PULL Image (local) Container RUN Container+CHANGE COMMIT PUSH
  26. 26. Docker architecture
  27. 27. Basic Command
  28. 28. Version $ docker version
  29. 29. Info $ docker info
  30. 30. Pull base image(s) $ docker pull <image-name:tag> image name
  31. 31. List images $ docker images
  32. 32. Run $ docker run <option> <image-name:tag> <command> <argument> image name command argument
  33. 33. List container $ docker ps -a
  34. 34. Running container
  35. 35. Running container Ctlr + q to detach
  36. 36. Running container
  37. 37. Linking & Expose
  38. 38. Linking LOCALHOST PHP + Apache Container MySQL Container Localhost:80 Localhost:3306
  39. 39. Linking LOCALHOST PHP + Apache Container MySQL Container Localhost:80 Localhost:3306
  40. 40. Linking LOCALHOST PHP + Apache Container MySQL Container Localhost:80
  41. 41. Linking & Expose image name Linking Expose port $ docker run –p <host-name>:<host-port>:<container-port>
  42. 42. Volume
  43. 43. Volume HOST Volume directory …….. CONTAINER /var/www/html …… Isolation
  44. 44. Volume HOST Volume directory …….. CONTAINER /var/www/html …… How could we mount container’s directory to host?
  45. 45. Volume HOST Volume directory …….. CONTAINER /var/www/html …… Volume • Real time changes • Exist until container destroyed • Can set RO mode
  46. 46. Volume HOST Volume directory …….. CONTAINER A /var/www/html …… Volume CONTAINER B /var/www/html ……
  47. 47. Dockerfile • Automatically build images and deploy • Automated build on Docker Hub • Easy to share and customize config
  48. 48. Docker Compose • Define and run multi-container applications • Specify images and configuration in a simple YAML file: docker-compose.yml • One command to get all running: docker-compose up
  49. 49. Demo
  50. 50. Demo LOCALHOST Wordpress + Apache Container MySQL Container Localhost:80
  51. 51. Docker advantages
  52. 52. Docker advantages
  53. 53. Docker advantages
  54. 54. Docker advantages
  55. 55. Why Developers Care Build once.. (finally) run anywhere* • A clean, safe, hygienic, portable runtime environment for your app. • No worries about missing dependencies, packages and other pain points during subsequent deployments. • Run each app in its own isolated container, so you can run various versions of libraries and other dependencies for each app without worrying. • Automate testing, integration, packaging...anything you can script. • Reduce/eliminate concerns about compatibility on different platforms, either your own or your customers. • Cheap, zero-penalty containers to deploy services. A VM without the overhead of a VM. Instant replay and reset of image snapshots. * "anywhere" means an x86 server running a modern Linux kernel (3.2+ generally or 2.6.32+ for RHEL 6.5+, Fedora, & related)
  56. 56. Why Administrators Care Configure once.. Run anything • Make the entire lifecycle more efficient, consistent, and repeatable • Increase the quality of code produced by developers. • Eliminate inconsistencies between development, test, production, and customer environments. • Support segregation of duties. • Significantly improves the speed and reliability of continuous deployment and continuous integration systems. • Because the containers are so lightweight, address significant performance, costs, deployment, and portability issues normally associated with VMs.
  57. 57. Resource & Reference • Docs.docker.com • Docker Cookbook • Docker in Practice • Katacoda.com
  58. 58. Thank you!
  59. 59. Q & A

×