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.

Building Reusable Development Environments with Docker

225 views

Published on

Docker is a relatively new technology, but it is based on solid underpinnings of the Linux Kernel. It can allow the provisioning of instances in a fraction of the time that it would to prepare a traditional virtual machine. This has made it a great candidate in aiding development teams to create consistent test benches for all their developers. All the while helping bring an end to the “Works on Dev, but not Test” or “Works on my machine” scenarios. With the help of Docker, personal development environments and disposable CI environments can all be created to improve the development experience. To learn how to setup your own disposable Docker environments bring a laptop and your enthusiasm to make development a more pleasurable experience.

Published in: Technology

Building Reusable Development Environments with Docker

  1. 1. Building Reusable Development Environments with Docker Harold Dost Raastech, Inc. CC BY 3.0 US, Harold A. Dost III 1
  2. 2. About the Speaker Work For Raastech, Inc. - Virginia/DC Area 1 1 Image source: https://upload.wikimedia.org/wikipedia/ commons/d/d2/USNavy030926- F-2828D-307AerialviewoftheWashingtonMonument.jpg CC BY 3.0 US, Harold A. Dost III 2
  3. 3. Live in Michigan2 • Detroit Metro Area 2 Images Source: Wikipedia CC BY 3.0 US, Harold A. Dost III 3
  4. 4. Core Java CC BY 3.0 US, Harold A. Dost III 4
  5. 5. Shameless Plug • For SOA Administration • Buy From Packt Website • Promo Code for 50% off: UKOUG50 • Valid until Dec 15, 2016 CC BY 3.0 US, Harold A. Dost III 5
  6. 6. Lately • Primarily working as Lead QA for Client creating IoT devices • Part of the Release team CC BY 3.0 US, Harold A. Dost III 6
  7. 7. Typical Steps 1.Setup Database 2.Create Schemas 3.Setup Server 4.Deploy Application CC BY 3.0 US, Harold A. Dost III 7
  8. 8. Basic Java App [Kinda] Demo CC BY 3.0 US, Harold A. Dost III 8
  9. 9. Code Quality 3 3 Image Source: http://xkcd.com/1695/ CC BY 3.0 US, Harold A. Dost III 9
  10. 10. Consistency 4 • Vagrant • Chef • Puppet • Ansible 4 Image Source: https://www.flickr.com/photos/cadsonline/ 889810973 CC BY 3.0 US, Harold A. Dost III 10
  11. 11. Docker CC BY 3.0 US, Harold A. Dost III 11
  12. 12. Docker Ecosystem CC BY 3.0 US, Harold A. Dost III 12
  13. 13. Tools • Docker Machine • Docker Engine • Docker Registry • Docker Compose CC BY 3.0 US, Harold A. Dost III 13
  14. 14. Using Docker Machine CC BY 3.0 US, Harold A. Dost III 14
  15. 15. Docker Machine • This aids in creating docker hosts • The target of these can be: • Cloud Providers • AWS • Digital Ocean • Google Cloud Platform CC BY 3.0 US, Harold A. Dost III 15
  16. 16. Docker Machine cont. • Other VM Targets • OpenStack • Oracle VirtualBox • VMware Fusion® • vCloud® Air™ • vSphere® CC BY 3.0 US, Harold A. Dost III 16
  17. 17. Docker Machine Creates a dummy machine docker-machine create --driver virtualbox default CC BY 3.0 US, Harold A. Dost III 17
  18. 18. Docker Engine • Basis of Eco-system • Mediate between containers and host CC BY 3.0 US, Harold A. Dost III 18
  19. 19. Benefits • Lightweight • Walled off from other process • Repeatable CC BY 3.0 US, Harold A. Dost III 19
  20. 20. Definitions • Images • VM • Docker • Container CC BY 3.0 US, Harold A. Dost III 20
  21. 21. How does Docker work? • LXC -> libcontainer5 • Control Groups: Limit Resources of Process Groups • Kernel Namespaces: Isolates resources 5 http://www.zdnet.com/article/docker-libcontainer-unifies-linux-container-powers/ CC BY 3.0 US, Harold A. Dost III 21
  22. 22. Difference between Containers and VMs 6 6 Image Source: http://www.docker.com/what-docker CC BY 3.0 US, Harold A. Dost III 22
  23. 23. Limitations - Linux • Linux Kernel Based OS (Ubuntu, CentOS, Arch, Etc.) • Minimum of Kernel 3.10 CC BY 3.0 US, Harold A. Dost III 23
  24. 24. Limitations - Windows Host • Microsoft Windows Server 2016 CC BY 3.0 US, Harold A. Dost III 24
  25. 25. Windows Specific Containers • Windows Server Containers • Hyper-V Containers CC BY 3.0 US, Harold A. Dost III 25
  26. 26. Dockerfile 7 FROM java:8 RUN apt-get update RUN apt-get install -y maven nodejs EXPOSE 9000 WORKDIR /app COPY app /app RUN chown -R appuser /app USER appuser ENTRYPOINT mvn spring-boot:run 7 For more information about the Dockerfile format check here. CC BY 3.0 US, Harold A. Dost III 26
  27. 27. Using Docker Engine • 39 Different commands • Only covering some of the most used CC BY 3.0 US, Harold A. Dost III 27
  28. 28. Commands: Retrieve pull - Pull an image or a repository from a registry CC BY 3.0 US, Harold A. Dost III 28
  29. 29. Commands: Create and Delete create - Create a new container rm - Remove one or more containers rmi - Remove one or more images CC BY 3.0 US, Harold A. Dost III 29
  30. 30. Demo Commands CC BY 3.0 US, Harold A. Dost III 30
  31. 31. Commands: Start and Stop start - Start 1+ stopped containers stop - Stop a running container exec - Run command in running container run - Run command in new container kill - Kill a running container restart - Restart a running container CC BY 3.0 US, Harold A. Dost III 31
  32. 32. Windows Caveat • To enable hyper-v at runtime --isolation=hyperv CC BY 3.0 US, Harold A. Dost III 32
  33. 33. MAVEN Plugins • https://github.com/spotify/docker-maven-plugin • https://github.com/rhuss/docker-maven-plugin • https://github.com/wouterd/docker-maven-plugin CC BY 3.0 US, Harold A. Dost III 33
  34. 34. Quick Maven Demo CC BY 3.0 US, Harold A. Dost III 34
  35. 35. Commands: Organize rename - Rename a container tag - Tag an image into a repository commit - Create a new image from a container's changes CC BY 3.0 US, Harold A. Dost III 35
  36. 36. Commands: Etc. cp - Copy files to and from containers port - List port mappings ps - List containers attach - Attach to a running container CC BY 3.0 US, Harold A. Dost III 36
  37. 37. Docker Registry • Place to Store your images • Can run in a container also CC BY 3.0 US, Harold A. Dost III 37
  38. 38. Docker Compose • Create Multi-container Applications • Example: • Java App • Database CC BY 3.0 US, Harold A. Dost III 38
  39. 39. Docker Compose • Uses decriptor file compose.yml • Brings up an application CC BY 3.0 US, Harold A. Dost III 39
  40. 40. Docker Compose Commands build - Build or rebuild services kill - Kill containers up - Create and start containers migrate-to-labels - Recreate containers to add labels version - Show the Docker-Compose version information CC BY 3.0 US, Harold A. Dost III 40
  41. 41. The docker-compose.yml 8 web: build: . links: - db ports: - "8000:8000" db: image: postgres 8 For more information about file arguments check here. CC BY 3.0 US, Harold A. Dost III 41
  42. 42. Demo docker- compose CC BY 3.0 US, Harold A. Dost III 42
  43. 43. Docker on Windows • https://msdn.microsoft.com/en-us/ virtualization/windowscontainers/deployment/ docker_windows Resources • https://msdn.microsoft.com/en-us/ virtualization/windowscontainers/deployment/ CC BY 3.0 US, Harold A. Dost III 43
  44. 44. Project 9 • https://github.com/hdost/ docker-presentation 9 Image Source: http://xkcd.com/1597/ CC BY 3.0 US, Harold A. Dost III 44
  45. 45. Questions? CC BY 3.0 US, Harold A. Dost III 45
  46. 46. Contact • Harold Dost • @hdost • harold.dost@raastech.com CC BY 3.0 US, Harold A. Dost III 46
  47. 47. CC BY 3.0 US, Harold A. Dost III 47

×