Successfully reported this slideshow.

Setting Sail With Docker

1

Share

Loading in …3
×
1 of 47
1 of 47

Setting Sail With Docker

1

Share

Download to read offline

A high-level overview of Docker concepts and getting started with Docker.

Outline:
1. What is a container?
2. What is Docker?
3. Running containers
4. Working with containers
5. Building your own containers
6. Improving your containers

A high-level overview of Docker concepts and getting started with Docker.

Outline:
1. What is a container?
2. What is Docker?
3. Running containers
4. Working with containers
5. Building your own containers
6. Improving your containers

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Setting Sail With Docker

  1. 1. Setting Sail With Docker Katie Hempenius CONNECT 2016 March 19th, 2016
  2. 2. Me • Software Engineer at Fitbit • @katiehempenius • WWC San Francisco 2Connect 2016
  3. 3. Why Docker? 3Connect 2016
  4. 4. Why Docker? Connect 2016 4
  5. 5. Today’s Presentation 1. What is a container? 2. What is Docker? 3. Running containers 4. Working with containers 5. Building your own containers 6. Improving your containers 5Connect 2016
  6. 6. WHAT IS A CONTAINER? 1. 6Connect 2016
  7. 7. The Container Metaphor 7Part 1: What is a container?Connect 2016
  8. 8. Containers run software reliably across different environments. Connect 2016 Part 1: What is a container? 8
  9. 9. Server 99Part 1: What is a container?Connect 2016
  10. 10. Virtual Machine (VM) An emulation of a computer system. 10Part 1: What is a container?Connect 2016
  11. 11. Virtual Machine Virtual Machine Virtual Machine (VM) • One physical machine can run multiple virtual machines. 11Part 1: What is a container?Connect 2016 Server Operating System Operating System Application Application Virtual Machine Operating System Application
  12. 12. Containers • Small-footprint, quick startup Connect 2016 Part 1: What is a container? 12 Container Operating System Docker Engine Application Container Container Container Server Container Application Application Application Application
  13. 13. Containers are Not Magical 13Part 1: What is a container?Connect 2016 Security Concerns Linux-Only !DevOps Cure-all
  14. 14. Containers (Summary) • Run software reliably across different environments • Space-efficient • Less isolated than VMs (security) 14Part 1: What is a container?Connect 2016
  15. 15. WHAT IS DOCKER? 2. 15Connect 2016
  16. 16. Docker 16Part 2: What is Docker?Connect 2016
  17. 17. Docker Toolbox Connect 2016 Part 2: What is Docker? 17
  18. 18. Docker Client 18Part 2: What is Docker?Connect 2016 Client Container
  19. 19. Docker Daemon 19 Daemon Part 2: What is Docker?Connect 2016 Client Container
  20. 20. Virtual Machine Docker on OSX/Windows 20 Host Part 2: What is Docker?Connect 2016 DaemonClient Container
  21. 21. Docker (Summary) • Rapidly-growing, open-source software • Install Docker Toolbox to get started on Windows or Mac 21Part 2: What is Docker?Connect 2016
  22. 22. RUNNING CONTAINERS 3. 22Connect 2016
  23. 23. Images • A container is created from an image • Image: an immutable file that is a snapshot of a container 23 ContainerImage Part 3: Running ContainersConnect 2016
  24. 24. DockerHub • DockerHub is a repository for Docker images 24Part 3: Running ContainersConnect 2016
  25. 25. Creating a container • $ docker run <image> […] 25 $ docker run … Container Image Part 3: Running ContainersConnect 2016
  26. 26. Running Containers (Summary) • Containers are created from images • $docker run creates a container • Images can be obtained from DockerHub Connect 2016 Part 3: Running Containers 26
  27. 27. WORKING WITH CONTAINERS 4. 3/19/2016 27
  28. 28. Listing containers • $ docker ps – Container ID, Image, Command, Created, Status, Ports, Names Connect 2016 Part 4: Working with Containers 28 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4c01db0b339c ubuntu:12.04 bash 17 seconds ago Up 16 seconds 3300-3310/tcp webapp d7886598dbe2 crosbymichael/redis:latest /redis-server --dir 33 minutes ago Up 33 minutes 6379/tcp redis,webapp/db $ docker ps -a -a (--all): all containers, not just running
  29. 29. Managing containers • $ docker start <container> • $ docker stop <container> • $ docker kill <container> Connect 2016 Part 4: Working with Containers 29
  30. 30. $ docker exec <container> <command> • Run a command in a running container 30Part 4: Working with ContainersConnect 2016 $ docker exec -it <container> bash
  31. 31. Using Containers (Summary) • Use $docker ps to view a list of your containers • You can enter a running Docker container ($ docker exec -it <container> bash) Connect 2016 Part 4: Working with Containers 31
  32. 32. BUILDING YOUR OWN CONTAINERS 4. 32Connect 2016
  33. 33. Building your own container • An image is created from a Dockerfile 33 ContainerImageDockerfile Part 5: Building Your Own ContainersConnect 2016
  34. 34. Dockerfile • Text-file containing Docker commands. Connect 2016 Part 5: Building Your Own Containers 34 FROM ubuntu RUN apt-get –y update && apt-get install –y nodejs CMD echo “Hi, today is $(date)”
  35. 35. FROM <base image> • Specifies “starting point” for building image 3535Connect 2016 Part 5: Building Your Own Containers FROM ubuntu
  36. 36. RUN <command(s)> • Command(s) to execute when building the container 3636Connect 2016 Part 5: Building Your Own Containers FROM ubuntu RUN apt-get –y update && apt-get install –y nodejs
  37. 37. CMD <command> • Default command to execute when container is started 37 FROM ubuntu RUN apt-get –y update && apt-get install –y nodejs CMD echo “Hi, today is $(date)” Connect 2016 Part 5: Building Your Own Containers
  38. 38. Building a container • $ docker build <path> […] 38 ContainerImageDockerfile $ docker build […] Connect 2016 Part 5: Building Your Own Containers $ docker build .
  39. 39. Building Your Own Containers (Summary) • A Dockerfile is a text document of Docker commands • $docker build creates an image from a Dockerfile Connect 2016 Part 5: Building Your Own Containers 39
  40. 40. IMPROVING YOUR CONTAINERS 5. 40Connect 2016
  41. 41. Volumes Data storage that is independent of a container. 41 ContainerVolume Part 6: Improving Your ContainersConnect 2016
  42. 42. Volumes • Flag with $docker run: – --volume <file or directory> – --volumes-from <container> 42Part 6: Improving Your ContainersConnect 2016 $ docker run –v /path/to/file:/assets ubuntu $ docker run --volumes-from db1 ubuntu File/directory location on Host : Location in Container container
  43. 43. Use Separate Containers 4343 MongoNGINX Node.js Part 6: Improving Your ContainersConnect 2016
  44. 44. Use Separate Containers • Docker Compose • ---link flag (with $docker run) Connect 2016 Part 6: Improving Your Containers 44 $ docker run --link server_container:server ubuntu Container : Alias
  45. 45. Improving Your Containers (Summary) • Always use volumes • Use separate containers when appropriate Connect 2016 Part 6: Improving Your Containers 45
  46. 46. In summary… 46 ImageDockerfile Container Connect 2016 Deployment
  47. 47. Thank you! Bon Voyage! 47Connect 2016 @katiehempenius

×