SlideShare a Scribd company logo
1 of 28
Docker 101 
An Introduction to Containerizing Apps 
Benjamin Schmidt 
kWantera.com CTO
Agenda 
● What is Docker? 
● Using Docker 
● What can you do with Docker? 
● Examples 
● Tech that extends Docker
Talk’s Purpose 
● While simple, Docker is expansive in it’s 
capabilities 
● I’d like to cover enough so people can 
understand the concepts 
● I leave it to the docs and SO for becoming 
“experts”
What is Docker? 
“open platform … to build, ship and run 
distributed applications” 
Linux virtualization made easy (and light-weight)
A Container For Your App 
● You’ve got code 
● Docker is a self-contained, customizable 
linux environment to run that code 
● It is a virtual machine without the full OS
Origins (-ish) 
● Linux containers (LXC) :: sort of like chroot 
● Create a kernel separated environment for 
security purposes 
● Since it’s part of kernel = does not require a 
full OS 
● Can run multiple containers on same system 
● Sprinkle in resource constraints 
● Add a dash of environment scripting
Representation 
You have an “App” you want 
to run: 
● Mongo server 
● HTTP server 
● Long-running script 
● An ad-hoc backup script 
image source: docker.io
Representation 
Traditionally you run it on a 
“full server” 
image source: docker.io 
Required 
libraries 
The physical 
hardware
Representation 
Virtualization solved the 
multiple-app / library 
problem 
● Still a single physical hardware server 
image source: docker.io 
Use Virtualization to 
mirror the “physical” 
hardware at OS level
Representation 
Some inefficiencies pop-up 
● Architecture duplication 
● Setting up “fully systems” 
=> Leads to resource waste 
image source: docker.io 
HEAVY copying & 
redundancy 
Potentially 
redundant
Representation 
Docker Solution 
● There is only one running “full OS” 
o You use a dedicated portion of kernel 
resources 
● Much lighter weight leads to: 
o Easily cloneable containers 
o Sharing system libraries versus program 
libraries (i.e. a portion of the host kernel) 
image source: docker.io
Terminology 
● Container 
o Runs your code using a specified environment 
(Image) and the command you wish to execute in 
that environment 
● Image 
o An environment complete with the type of OS and 
any setup instructions for generating that 
environment
Using Docker 
● Docker has a pretty simple command line 
API* 
o run: converts images and commands into containers 
o start/stop: starts or stops containers 
o ps: inspect the available containers and their status 
o images: list all available images (locally 
downloaded) 
o build: builds image (e.x from a Dockerfile) 
*Other commands exist for more fine-grained control and inspection
At this point... 
● I want to give a flavor for Docker usage 
without all the details 
o See the Docs for extensive coverage 
o This is just a 101 course :)
Let’s start a docker container... 
$ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ 
Hello World
Let’s start a docker container... 
Accesses LXC 
under the hood 
(needs root) 
The type of 
Image 
Convert from 
Image to 
Container 
The command to 
run in that image 
type 
$ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ 
Hello World
And if you wanted to test in multiple 
OS’s... 
$ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ 
Hello World 
$ sudo docker run ubuntu /bin/echo ‘Hello World’ 
Hello World 
$ sudo docker run centos /bin/echo ‘Hello World’ 
Hello World 
$ sudo docker run debian /bin/echo ‘Hello World’ 
Hello World
A few notes 
● Program printed to STDOUT (the console) 
● If you run `sudo docker ps` you won’t see 
any currently running containers (it stopped) 
● Running `sudo docker ps -a` will show a 
stopped container
And if you want an interactive shell... 
$ sudo docker run -t -i ubuntu:14.04 /bin/bash 
root@ae23f43: | 
-t = pseudo-tty 
terminal 
-i = interactive (STDIN is 
piped into process)
And if you want an interactive shell... 
$ sudo docker run -t -i ubuntu:14.04 /bin/bash 
root@ae23f43: | 
And to know you’re not in a full OS, try 
`top`... only two processes
And throw a process into 
background... 
$ sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; 
done" 
1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147 
-d = daemonize 
leaving off :14.04 provides 
the “latest” version 
Returns the 
container ID
Bind ports inside container to host... 
$ sudo docker run -d -p 5000:5000 ubuntu python myserver.py 
-p = port mapping. 
(lower case) 
Inside:Outside
Dockerfile 
Create Images # Put this in a file called Dockerfile 
FROM ubuntu 
MAINTAINER Ben Schmidt <ben@example.com> 
RUN apt-get update 
$ cd ~/myserver 
$ sudo docker build -t=”myimage” . 
$ sudo docker run -i -it myimage /bin/bash 
A Dockerfile in ~/myimage/ 
-t = Set the name of the 
image
Things to be Aware of... 
● Containers run in their own environment 
o Files, ports, and host data must be “mapped” to the 
container 
o EXPOSE: exposes ports to host 
o ADD: copies local host files into container 
● Volumes allow exposure of host OS 
filesystem to containers 
o Can get very tricky! But allows shared storage and 
even containers that act as storage only
Things to be Aware of... 
● Images are stored with a VCS-ish 
o Each line in a Dockerfile creates a new image 
o FROM command allows stacking of images 
o Can create parent-child relationships 
o sudo docker commit or pull 
● Docker Hub 
o Store your images in the cloud 
o This is default how we access many of the common 
images (ubuntu, centos etc.) 
o Can also create your own private repository
Things to be Aware of... 
● Resource limits 
o Can set CPU and RAM limits 
● Networking 
o Docker creates an elaborate networking 
infrastructure via clever use of /etc/hosts 
o Do not modify /etc/hosts!! or do so at peril
Neat tech out there today... 
Docker swarm: 
https://github.com/docker/swarm 
CoreOS Rocket: 
https://github.com/coreos/rocket
Thanks!! 
Contact: 
Ben Schmidt 
kwantera.com

More Related Content

What's hot

Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
dotCloud
 

What's hot (20)

Docker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker RegistryDocker Ecosystem: Part V - Docker Registry
Docker Ecosystem: Part V - Docker Registry
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
 
Docker hands-on
Docker hands-onDocker hands-on
Docker hands-on
 
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps ItaliaWhen Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
When Docker ends, Chef begins ~ #idi2015 Incontro DevOps Italia
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Virtual Machines and Docker
Virtual Machines and DockerVirtual Machines and Docker
Virtual Machines and Docker
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Docker - A Ruby Introduction
Docker - A Ruby IntroductionDocker - A Ruby Introduction
Docker - A Ruby Introduction
 
Dockerandjenkins citz2014
Dockerandjenkins citz2014Dockerandjenkins citz2014
Dockerandjenkins citz2014
 
Docker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupDocker presentation | Paris Docker Meetup
Docker presentation | Paris Docker Meetup
 
Dockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at RackspaceDockerfile basics | docker workshop #1 at Rackspace
Dockerfile basics | docker workshop #1 at Rackspace
 
Docker Cheatsheet_01
Docker Cheatsheet_01Docker Cheatsheet_01
Docker Cheatsheet_01
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015
 
Launching containers with fleet
Launching containers with fleetLaunching containers with fleet
Launching containers with fleet
 
Docker 101
Docker 101Docker 101
Docker 101
 

Similar to Docker 101

Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and Containers
Docker, Inc.
 

Similar to Docker 101 (20)

Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021Primi passi con Docker - ItalianCoders - 12-01-2021
Primi passi con Docker - ItalianCoders - 12-01-2021
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Docker.pdf
Docker.pdfDocker.pdf
Docker.pdf
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
 
Introduction to Docker and Containers
Introduction to Docker and ContainersIntroduction to Docker and Containers
Introduction to Docker and Containers
 
Docker
DockerDocker
Docker
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Docker 101
Docker 101 Docker 101
Docker 101
 

Recently uploaded

Recently uploaded (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 

Docker 101

  • 1. Docker 101 An Introduction to Containerizing Apps Benjamin Schmidt kWantera.com CTO
  • 2. Agenda ● What is Docker? ● Using Docker ● What can you do with Docker? ● Examples ● Tech that extends Docker
  • 3. Talk’s Purpose ● While simple, Docker is expansive in it’s capabilities ● I’d like to cover enough so people can understand the concepts ● I leave it to the docs and SO for becoming “experts”
  • 4. What is Docker? “open platform … to build, ship and run distributed applications” Linux virtualization made easy (and light-weight)
  • 5. A Container For Your App ● You’ve got code ● Docker is a self-contained, customizable linux environment to run that code ● It is a virtual machine without the full OS
  • 6. Origins (-ish) ● Linux containers (LXC) :: sort of like chroot ● Create a kernel separated environment for security purposes ● Since it’s part of kernel = does not require a full OS ● Can run multiple containers on same system ● Sprinkle in resource constraints ● Add a dash of environment scripting
  • 7. Representation You have an “App” you want to run: ● Mongo server ● HTTP server ● Long-running script ● An ad-hoc backup script image source: docker.io
  • 8. Representation Traditionally you run it on a “full server” image source: docker.io Required libraries The physical hardware
  • 9. Representation Virtualization solved the multiple-app / library problem ● Still a single physical hardware server image source: docker.io Use Virtualization to mirror the “physical” hardware at OS level
  • 10. Representation Some inefficiencies pop-up ● Architecture duplication ● Setting up “fully systems” => Leads to resource waste image source: docker.io HEAVY copying & redundancy Potentially redundant
  • 11. Representation Docker Solution ● There is only one running “full OS” o You use a dedicated portion of kernel resources ● Much lighter weight leads to: o Easily cloneable containers o Sharing system libraries versus program libraries (i.e. a portion of the host kernel) image source: docker.io
  • 12. Terminology ● Container o Runs your code using a specified environment (Image) and the command you wish to execute in that environment ● Image o An environment complete with the type of OS and any setup instructions for generating that environment
  • 13. Using Docker ● Docker has a pretty simple command line API* o run: converts images and commands into containers o start/stop: starts or stops containers o ps: inspect the available containers and their status o images: list all available images (locally downloaded) o build: builds image (e.x from a Dockerfile) *Other commands exist for more fine-grained control and inspection
  • 14. At this point... ● I want to give a flavor for Docker usage without all the details o See the Docs for extensive coverage o This is just a 101 course :)
  • 15. Let’s start a docker container... $ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ Hello World
  • 16. Let’s start a docker container... Accesses LXC under the hood (needs root) The type of Image Convert from Image to Container The command to run in that image type $ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ Hello World
  • 17. And if you wanted to test in multiple OS’s... $ sudo docker run ubuntu:14.04 /bin/echo ‘Hello World’ Hello World $ sudo docker run ubuntu /bin/echo ‘Hello World’ Hello World $ sudo docker run centos /bin/echo ‘Hello World’ Hello World $ sudo docker run debian /bin/echo ‘Hello World’ Hello World
  • 18. A few notes ● Program printed to STDOUT (the console) ● If you run `sudo docker ps` you won’t see any currently running containers (it stopped) ● Running `sudo docker ps -a` will show a stopped container
  • 19. And if you want an interactive shell... $ sudo docker run -t -i ubuntu:14.04 /bin/bash root@ae23f43: | -t = pseudo-tty terminal -i = interactive (STDIN is piped into process)
  • 20. And if you want an interactive shell... $ sudo docker run -t -i ubuntu:14.04 /bin/bash root@ae23f43: | And to know you’re not in a full OS, try `top`... only two processes
  • 21. And throw a process into background... $ sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" 1e5535038e285177d5214659a068137486f96ee5c2e85a4ac52dc83f2ebe4147 -d = daemonize leaving off :14.04 provides the “latest” version Returns the container ID
  • 22. Bind ports inside container to host... $ sudo docker run -d -p 5000:5000 ubuntu python myserver.py -p = port mapping. (lower case) Inside:Outside
  • 23. Dockerfile Create Images # Put this in a file called Dockerfile FROM ubuntu MAINTAINER Ben Schmidt <ben@example.com> RUN apt-get update $ cd ~/myserver $ sudo docker build -t=”myimage” . $ sudo docker run -i -it myimage /bin/bash A Dockerfile in ~/myimage/ -t = Set the name of the image
  • 24. Things to be Aware of... ● Containers run in their own environment o Files, ports, and host data must be “mapped” to the container o EXPOSE: exposes ports to host o ADD: copies local host files into container ● Volumes allow exposure of host OS filesystem to containers o Can get very tricky! But allows shared storage and even containers that act as storage only
  • 25. Things to be Aware of... ● Images are stored with a VCS-ish o Each line in a Dockerfile creates a new image o FROM command allows stacking of images o Can create parent-child relationships o sudo docker commit or pull ● Docker Hub o Store your images in the cloud o This is default how we access many of the common images (ubuntu, centos etc.) o Can also create your own private repository
  • 26. Things to be Aware of... ● Resource limits o Can set CPU and RAM limits ● Networking o Docker creates an elaborate networking infrastructure via clever use of /etc/hosts o Do not modify /etc/hosts!! or do so at peril
  • 27. Neat tech out there today... Docker swarm: https://github.com/docker/swarm CoreOS Rocket: https://github.com/coreos/rocket
  • 28. Thanks!! Contact: Ben Schmidt kwantera.com