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.
Docker 101 
Intro to Docker 
Presented by: Adrian Otto 
Prepared for: Docker Los Angeles 
Date: August 20, 2014
Adrian Otto 
• Principal Architect, Rackspace 
• PTL, Solum 
• Chair, OpenStack Containers Team 
• Co-Chair, OASIS CAMP Te...
3
What is it? 
• Docker Engine 
– CLI 
– Docker Daemon 
– Docker Registry 
• Docker Hub 
– Cloud service 
• Share Applicatio...
5
Cgroups Namespaces Image Docker 
Container 
Container 
• Combines several things 
– Linux Cgroups 
– Kernel Namespaces 
– ...
Linux Cgroups 
• Kernel Feature 
• Groups of processes 
• Control resource allocations 
– CPU 
– Memory 
– Disk 
– I/O 
• ...
Linux Kernel Namespaces 
• Kernel Feature 
• Restrict your view of the system 
– Mounts (CLONE_NEWNS) 
– UTS (CLONE_NEWUTS...
Docker Image 
9 
Base Image 
Child Image 
Grandchild Image 
• NOT A FILESYSTEM 
• NOT A VHD 
• Basically a tar file 
• Has...
Docker Registry 
10 
Base Image 
Child Image 
Grandchild Image 
• Git Repo Symantics 
• Pull 
• Push 
• Commit 
• Hierarch...
Cgroups Namespaces Image Docker 
Container 
Container 
• Combines several things 
– Linux Cgroups 
– Kernel Namespaces 
– ...
Dockerfile Base 
Image 
Docker 
Container 
Dockerfile 
• Like a Makefile (shell script with keywords) 
• Extends from a Ba...
Dockerfile Example 
FROM centos 
MAINTAINER aotto@aotto.com 
RUN yum -y install openssh-server 
EXPOSE 22 
ADD start.sh /s...
Dockerfile Example 
FROM adrian_server_with_ssh 
MAINTAINER aotto@aotto.com 
RUN yum -y install httpd 
EXPOSE 22 80 
ADD s...
Docker Container Lifecycle 
• The Life of a Container 
– Conception 
• BUILD an Image from a Dockerfile 
– Birth 
• RUN (c...
Docker CLI Commands (v1.1.2) 
attach Attach to a running container! 
build Build an image from a Dockerfile! 
commit Creat...
17 
Questions Before Demo?
18 
Demo
Demo 
• Build an Image from a Dockerfile 
• Manually tweak an image, commit, and start a new container 
• Install patches ...
20
Upcoming SlideShare
Loading in …5
×

Docker 101 - Intro to Docker

9,602 views

Published on

Adrian Otto from Rackspace will present his perspective of "Docker 101", for Docker novices. Learn the difference between Dockerfiles, containers, running containers, terminated containers, container images, Docker Registry, and a demo of the Docker CLI that goes beyond what you learn from the online simulator.

Published in: Technology

Docker 101 - Intro to Docker

  1. 1. Docker 101 Intro to Docker Presented by: Adrian Otto Prepared for: Docker Los Angeles Date: August 20, 2014
  2. 2. Adrian Otto • Principal Architect, Rackspace • PTL, Solum • Chair, OpenStack Containers Team • Co-Chair, OASIS CAMP Technical Committee 2
  3. 3. 3
  4. 4. What is it? • Docker Engine – CLI – Docker Daemon – Docker Registry • Docker Hub – Cloud service • Share Applications • Automate workflows • Assemble apps from components 4
  5. 5. 5
  6. 6. Cgroups Namespaces Image Docker Container Container • Combines several things – Linux Cgroups – Kernel Namespaces – Docker Image – Has a lifecycle 6
  7. 7. Linux Cgroups • Kernel Feature • Groups of processes • Control resource allocations – CPU – Memory – Disk – I/O • May be nested 7
  8. 8. Linux Kernel Namespaces • Kernel Feature • Restrict your view of the system – Mounts (CLONE_NEWNS) – UTS (CLONE_NEWUTS) • uname() output – IPC (CLONE_NEWIPC) – PID (CLONE_NEWPID) – Networks (CLONE_NEWNET) – User (CLONE_NEWUSER) • Not supported in Docker yet • Has privileged/unprivileged modes today • May be nested 8
  9. 9. Docker Image 9 Base Image Child Image Grandchild Image • NOT A FILESYSTEM • NOT A VHD • Basically a tar file • Has a hierarchy • Arbitrary depth • Fits into the Docker Registry
  10. 10. Docker Registry 10 Base Image Child Image Grandchild Image • Git Repo Symantics • Pull • Push • Commit • Hierarchy
  11. 11. Cgroups Namespaces Image Docker Container Container • Combines several things – Linux Cgroups – Kernel Namespaces – Docker Image – Has a lifecycle 11
  12. 12. Dockerfile Base Image Docker Container Dockerfile • Like a Makefile (shell script with keywords) • Extends from a Base Image • Results in a new Docker Image • Imperitave, not Declarative 12
  13. 13. Dockerfile Example FROM centos MAINTAINER aotto@aotto.com RUN yum -y install openssh-server EXPOSE 22 ADD start.sh /start.sh CMD /start.sh 13
  14. 14. Dockerfile Example FROM adrian_server_with_ssh MAINTAINER aotto@aotto.com RUN yum -y install httpd EXPOSE 22 80 ADD start.sh /start.sh CMD /start.sh 14
  15. 15. Docker Container Lifecycle • The Life of a Container – Conception • BUILD an Image from a Dockerfile – Birth • RUN (create+start) a container – Reproduction • COMMIT (persist) a container to a new image • RUN a new container from an image – Sleep • KILL a running container – Wake • START a stopped container – Death • RM (delete) a stopped container • Extinction – RMI a container image (delete image) 15
  16. 16. Docker CLI Commands (v1.1.2) attach Attach to a running container! build Build an image from a Dockerfile! commit Create new image from container's changes! cp Copy files from containers fs to host! diff Inspect changes on a container's fs! events Get real time events from the server! export Stream contents of container as tar! history Show the history of an image! images List images! import Create new fs image from a tarball! info Display system-wide information! inspect Return low-level info on a container! kill Kill a running container! load Load an image from a tar archive! login Login to the docker registry server! logs Fetch the logs of a container! port Lookup public-facing port! pause Pause all processes within a container! ps List containers! pull Pull image or repo from docker registry ! push Push image or repo to docker registry! restart Restart a running container! rm Remove one or more containers! rmi Remove one or more images! run Run a command in a new container! save Save an image to a tar archive! search Search for an image in the docker index! start Start a stopped container! stop Stop a running container! tag Tag an image into a repository! top Lookup running processes of a container! unpause Unpause a paused container! version Show the docker version information! wait Block and print exit code upon cont exit! 16
  17. 17. 17 Questions Before Demo?
  18. 18. 18 Demo
  19. 19. Demo • Build an Image from a Dockerfile • Manually tweak an image, commit, and start a new container • Install patches in a container, and tag it as :latest • Show different distros running on the same kernel • Run a container using a different CMD than the built-in one 19
  20. 20. 20

×