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

Docker - An introduction

Hugo Henley
November 23, 2016

Docker - An introduction

- Introduction
- Docker: Installing, architecture, commands
- Hands on

Hugo Henley

November 23, 2016
Tweet

More Decks by Hugo Henley

Other Decks in Programming

Transcript

  1. 23/11/2016 Docker Workshop - 1st Day Hugo Arraes Henley -

    hugohenley at id dot uff dot br An Introduction 1
  2. whoami ✤ Telecommunications Engineer @ UFF ✤ 7 years of

    experience with software development ✤ Solutions Architect @ STI-UFF ✤ Master's candidate in Computer Science @ UFF
  3. Before we start… ✤ Questions: #workshop-docker at Slack ✤ Urgent

    questions: ask anytime ✤ We will have a break at 15:45~16:00 ✤ Today: 90 slides ✤ Check your cellphones 4
  4. Motivation and Target audience ✤ Did you ever spent hours

    to install and configure a software? ✤ Have you ever heard “Works on my machine?!” from a dev/ ops guy? ✤ Forgot to install a library or linux package in the production environment? ✤ Avoided to release your software’s new cool feature in production in a dark friday night? Hmm…let’s do it next week, I want to sleep tonight. 5
  5. 7

  6. 10

  7. 11

  8. 12

  9. 13

  10. 14

  11. 15

  12. 16

  13. 17

  14. 18

  15. Docker Server Host OS Hypervisor Guest OS Bin/Libs App A

    Guest OS Bin/Libs App B Server Host OS Docker Engine Bin/Libs App A Bin/Libs App B VMs Containers 19
  16. 23

  17. Installing $ sudo apt-get update $ sudo apt-get install apt-transport-https

    ca-certificates $ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv- keys 58118E89F3A912897C070ADBF76221572C52609D $ echo deb https://apt.dockerproject.org/repo ubuntu-trusty main | sudo tee /etc/apt/sources.list.d/docker.list $ sudo apt-get update $ sudo apt-get install docker-engine $ sudo service docker start 26
  18. Docker Images ✤ Read-only ✤ Used to create containers ✤

    Defined by Dockerfiles ✤ ‘docker build’ command to create an image 28
  19. Docker Registries ✤ Where you store your images ✤ Ex:

    DockerHub ✤ There are a lot of images ready to be used on DockerHub! 29
  20. Docker Containers ✤ “Instance of an image” ✤ Are self-contained

    ✤ Can be started, stopped, deleted… ✤ ‘docker run’ command to start running your container 30
  21. 31

  22. 35

  23. 39

  24. 41

  25. 49

  26. 50

  27. 51

  28. docker exec Running a background task inside a container Running

    an interactive command inside a container sudo docker exec -d hugo_container touch /home/workshop.txt sudo docker exec -it hugo_container /bin/bash 57
  29. -- restart=always Automatically restarting containers sudo docker run - -

    restart=always - - name hugo_container -d ubuntu sudo docker stop CONTAINER_ID 59
  30. 64

  31. Dockerfile 65 Think about the sequence of steps needed to

    start your application from scratch Ex: install some ubuntu package, run some command…
  32. Dockerfile ✤ FROM ✤ MAINTAINER ✤ RUN ✤ CMD ✤

    EXPOSE ✤ ENV ✤ ADD/COPY ✤ VOLUME ✤ WORKDIR ✤ …
  33. 68

  34. 69

  35. 78

  36. 79

  37. Things you need to consider ✤ Container Orchestration ✤ 12factor

    ✤ Automation ✤ Build, build, deploy, deploy, deploy, scale, scale, repeat, repeat 82
  38. If you are not prepared to fail ✤ You will

    never sleep ✤ Your new-awesome-release can be a disaster ✤ You will do repetitive tasks, daily 83
  39. 84

  40. If you are not prepared to fail ✤ You will

    hate your job ✤ You will be stressed ✤ You will die earlier ✤ Trust me: you don't want a future like this 85
  41. Tomorrow ✤ How people really use Docker ✤ What if

    I have thousands of machines? ✤ What if some hardware stops working ✤ Challenges ✤ Future