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

DockerCon 2019 - Containers for Beginners

DockerCon 2019 - Containers for Beginners

Feeling overwhelmed while getting started with containers? Have you been tasked to figure out how to train everyone back at your organization? There's just so much to learn and teach! In this talk, we’ll start with a tiny bit of history to motivate the "why" and quickly move into the "what" by explaining what container and images actually are (they're not just magical black boxes!). We'll talk about how volumes help with data persistence and include an overview of Docker Compose and even orchestration. There will be plenty of live demos and fun!



Michael Irwin

April 30, 2019


  1. Containers for Beginners

  2. @mikesir87 Disclaimer: I cannot explain sprankle pods either!

  3. @mikesir87 Quick History of Shipping Source: https://www.publicdomainpictures.net/en/view-image.php?image=275355 Source: https://en.wikipedia.org/wiki/Rail_freight_in_Great_Britain Source:

  4. Software = Shipping?

  5. @mikesir87 Shipping in Software Source: https://www.usafe.af.mil/News/Photos/igphoto/2000887438/

  6. @mikesir87 Either of these two scenarios sound familiar to you?

  7. @mikesir87 Welcome! Glad to have you on the team! Clone

    the repo, use the wiki for setup instructions, and update the docs as needed. Good luck!
  8. @mikesir87

  9. @mikesir87 Imagine if...

  10. @mikesir87 Creating Images Dockerfile docker build FROM node WORKDIR /app

    COPY package.json yarn.lock . RUN yarn install COPY src ./src CMD ["node", "src/index.js"]
  11. @mikesir87 Sharing Images docker push Source: https://landscape.cncf.io

  12. @mikesir87 Let’s build an image!

  13. @mikesir87 What’s a container then? docker container run

  14. @mikesir87

  15. @mikesir87 Containers vs VMs Infrastructure Host Operating System Hypervisor Guest

    OS Bins/Libs App 1 Guest OS Bins/Libs App 2 Guest OS Bins/Libs App 3 Infrastructure Operating System Bins/Libs App 1 Bins/Libs App 2 Bins/Libs App 3 Docker Daemon
  16. @mikesir87 Image Layering Dockerfile docker image history

  17. @mikesir87 Layer contents file1 file2 file3 file4 file2 file5 file1

    file2 file3 file4 file5 Layer 1 Layer 2 Merged
  18. @mikesir87 What about deleted files? • • file1 file2 file3

    file4 file2 file5 file1 file2 file3 file5 Layer 1 Layer 2 Merged .wh.file4 Layer 3
  19. @mikesir87 WARNING! Be careful what you put into images. Deleted

    files might not actually be gone!
  20. @mikesir87 Two Best Practices Incoming!

  21. @mikesir87 Clean up as you go! • • RUN FROM

    ubuntu RUN apt-get update RUN apt-get install -y python python-pip RUN pip install awscli RUN apt-get autoremove --purge -y python-pip FROM ubuntu RUN apt-get update && \ apt-get install -y python python-pip && \ pip install awscli && \ apt-get autoremove --purge -y python-pip && \ rm -rf /var/lib/apt/lists/*
  22. @mikesir87 Keep images tight and focused FROM node AS build

    WORKDIR /usr/src/app COPY package.json yarn.lock . RUN yarn install COPY public ./public COPY src ./src RUN yarn build FROM nginx:alpine COPY nginx.conf /etc/nginx/nginx.conf COPY --from=build /usr/src/app/build /usr/share/nginx/html
  23. @mikesir87 How do you persist data?

  24. @mikesir87 • • ◦ ◦ -v $HOME/mysql-data:/var/lib/mysql • ◦ ◦

    docker volume inspect ◦ -v mysql-data:/var/lib/mysql Volumes
  25. @mikesir87 Show me these volumes!

  26. @mikesir87

  27. @mikesir87 Docker Compose docker-compose.yml

  28. @mikesir87 Docker Networking API 1 Database Reverse Proxy React App

    API 2 Cache
  29. @mikesir87 Quick compose demo!

  30. @mikesir87 Container Orchestration

  31. @mikesir87 Actors in Orchestration

  32. @mikesir87 Various Orchestrators

  33. @mikesir87 Quick Swarm Demo!

  34. @mikesir87 Recap

  35. @mikesir87 WARNING! Containers are NOT a silver bullet that will

    fix your company culture
  36. Thank you! Rate the session!