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.

Vagrant and Docker

831 views

Published on

A brief introduction on Vagrant and Docker, and how to use them to create portable and distributable development environments. Know why and how to use them for better development and faster deployment, including demonstration and code samples from this presentation.

Published in: Technology
  • Be the first to comment

Vagrant and Docker

  1. 1. Vagrant and Docker Portable Development Environments
  2. 2. Who we are Feroj Bepari Senior Software Engineer Nascenia Ltd. feroj@nascenia.com Samiul Hoque Senior Software Engineer Nascenia Ltd. samiul@nascenia.com 2
  3. 3. Development environments made easy Create and configure lightweight, reproducible, and portable development environments. 3
  4. 4. What Vagrant is ❏Development environment setup tool ❏Focused on automation ❏Lowers development environment setup time ❏Development - Production parity ❏No more “Works on my machine” excuses 4
  5. 5. Why Vagrant ❏Easy to configure ❏Reproducible and portable ❏Single consistent workflow ❏Industry-standard tools integration 5
  6. 6. Benefits of Vagrant ❏Isolate dependencies and their configuration ❏A single disposable, consistent environment ❏Creates a single Vagrantfile for a project and share with other developer/designers ❏Others just need to run vagrant up and everything is installed and configured for work. 6
  7. 7. Installation ❏ Download and Install VirtualBox https://www.virtualbox.org/wiki/Downloads ❏ Download and Install Vagrant http://www.vagrantup.com/downloads 7
  8. 8. Let us create a VM ❏ Ubuntu Server 14.04 (trusty64) ❏ Git ❏ LAMP Stack ❏ Composer ❏ Node ❏ Redis ❏ Memcached ❏ Beanstalkd ❏ Supervisor ❏ PHPMyAdmin ❏ The Web Application: ➭ A laravel installation ➭ A mysql database for the application ➭ Queue configuration 8
  9. 9. Initializing Vagrant 9 ❏mkdir vagrant-test ❏cd vagrant-test ❏laravel new testvagrant A fresh laravel will be installed in testvagrant directory. ❏vagrant init A new Vagrantfile will be placed in the vagrant-test directory. ❏vagrant up
  10. 10. Updating Host OS Names Hosts File 10
  11. 11. Access the Sample Vagrant Project The sample file is accessible at https://github.com/samiuln/vagrant-test 11
  12. 12. Provisioners ❏Shell Scripts ❏Puppet ❏Chef 12 ❏Ansible ❏Salt ❏Docker
  13. 13. An open platform for distributed applications for developers and sysadmins Build, Ship, Run 13
  14. 14. What Docker is ❏High level ❏ A lightweight VM ❏ Own process space ❏ Own network interface ❏ Can run stuff as root 14 ❏Low level ❏ Container = isolated processes ❏ Share kernel with host ❏ <<application container>>
  15. 15. Why Docker ❏Run everywhere ❏ Regardless of kernel version ❏ Regardless of host distro ❏ Physical or virtual, cloud or not ❏ Container and host architecture must match... 15 ❏Run anything ❏ If it can run on the host, it can run in the container ❏ If it can run on a Linux kernel, it can run
  16. 16. VMs vs. Containers 16
  17. 17. Why Container are Lightweight 17
  18. 18. Install Docker ❏Go to https://docs.docker.com/engine/installation/ ❏sudo docker run hello-world 18
  19. 19. Docker Hub ❏More than 100,000 public images ❏Push your image to public repository ❏Use anywhere, any time :) ❏https://hub.docker.com/ 19
  20. 20. Demo ❏Run mysql docker image from Docker hub ❏ docker run --name wordpressdb -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wordpress -d mysql:5.7 ❏Pull wordpress from docker hub ❏ docker pull wordpress ❏Run wordpress container from local ❏ docker run -e WORDPRESS_DB_PASSWORD=password -d --name wordpress --link wordpressdb:mysql wordpress 20
  21. 21. Demo (contd.) ❏Show all docker container ❏ docker ps, docker ps -a ❏Inspect wordpress configuration ❏ docker inspect wordpress 21
  22. 22. Demo (contd.) ❏Where is my SOURCE CODE? :( ❏ docker run -e WORDPRESS_DB_PASSWORD=password -d --name wordpress --link wordpressdb:mysql -p 127.0.0.2:8080:80 -v "$PWD/":/var/www/html wordpress ❏ TIRED typing command? ❏ Docker has a solution :) 22
  23. 23. Resources ❏https://github.com/ferojnascenia/docker-compose-wordpress/ ❏https://hub.docker.com/ ❏http://www.sitepoint.com/how-to-use-the-official-docker-wordpress- image/ 23
  24. 24. 24
  25. 25. 25

×