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.

Introduction to Docker

185 views

Published on

Talk given to university students during the "Seminari UPC 2017"

Published in: Technology
  • Be the first to comment

Introduction to Docker

  1. 1. Docker Containerize your stuf
  2. 2. ● Motivation ○ services ○ virtualization ● Docker! ● How we use docker ● Try it yourself Docker Index
  3. 3. ● vs. the monolyth! Docker Services and microservices
  4. 4. ● Using queues Docker Services and microservices
  5. 5. ● Emulate hardware (or a complete system) ○ Useful to: ■ work with a diferent hardware+software ■ work with several virtual machines in one machine ● Some hypervisors: VirtualBox (2007), VMWare (1998) ● Based in a “image” of the whole system Docker Virtualization
  6. 6. ● Images are too big to be portable ● Solution: Vagrant (2010) ○ Based on boxes ○ Uses a recipe (Vagrantfile) to install extra software, alter configurations, etc (a.k.a “provisioning”) ○ Just share the recipe! Docker Virtualization problems
  7. 7. ● Virtual machines take too long to start ○ Keep them on ● What if… we use the (already started) Linux kernel? Docker Virtualization problems
  8. 8. ● Docker (2013): allows independent "containers" to run within a single Linux instance (share kernel libraries) ● Docker container ○ piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries Docker Docker to the rescue!
  9. 9. ● Make single-task containers ● Deploy as you need (servers or cloud) Docker Docker
  10. 10. Docker Docker documentation
  11. 11. ● The recipe! ○ Based on public images hub.docker.com ■ Or use your private images (creating a registry) ○ Provision ■ Alter configuration, install libraries, copy files from host machine, etc Docker Dockerfile
  12. 12. FROM ubuntu:14.04 # install cowsay, and move the "default.cow" out, so we can overwrite it with "docker.cow" RUN apt-get update && apt-get install -y cowsay --no-install-recommends RUN rm -rf /var/lib/apt/lists/* RUN mv /usr/share/cowsay/cows/default.cow /usr/share/cowsay/cows/orig-default.cow # "cowsay" installs to /usr/games ENV PATH $PATH:/usr/games COPY docker.cow /usr/share/cowsay/cows/ RUN ln -sv /usr/share/cowsay/cows/docker.cow /usr/share/cowsay/cows/default.cow CMD ["cowsay"] Docker Dockerfile example (docker/whalesay:latest)
  13. 13. ● Build your own image ○ And use it as base for new recipes ● Create network ○ And connect containers ● Mount local directory in docker’s filesystem ○ -v localDir:/tmp/localDir ● Share hardware (display, usb, etc) between host and docker Docker Docker features
  14. 14. ● Docker compose ○ Orchestrate several containers ○ Complex recipes to launch complete environments ■ Ex. Wordpress, Ruby on Rails ● and other new tools ● ...up to docker swarm or kubernetes Docker Managing several containers
  15. 15. ● From Vagrant to Docker ○ First use with new projects ● Actual use ○ Development (14 “fat” containers) ○ Staging ● Production? ○ Not yet. But using same provisioning recipes. Docker How we use docker at ulabox
  16. 16. ● Install ○ https://docs.docker.com/ ○ Notice “Optional post-installation steps” ● docker run hello-world ● docker ps -a Docker Try docker yourself

×