SlideShare a Scribd company logo
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Container Days: Docker
101
October 13
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .2
Bill Maxwell
Principal Eng. @ Rancher Labs
@cloudnautique
bill@rancher.com
#ranchermeetup
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Agenda
Docker Intro
Container Basics
Building
Storage
Networking
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
STOP
Docker Install Time
https://docs.docker.com/engine/installation/
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
VM vs Containers
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Note: Containers ≠ microservices
…but containers are a good way of packaging and delivering microservices
[PS: you can still use VMs]
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Our Goal: A Production Container Service
7
Develop Build Containerize Test Deploy/Upgrade Operate
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Runtimes
runC
lxc/lxd
openVZ
rkt
docker
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker Containers
Mantra: Build once, run anywhere
• A clean and portable runtime environment for your application (or service)
• No worries about missing dependencies, packages, etc during subsequent
deployments
• Automate testing, integration, and packaging…anything you can script
• Reduce concerns around compatibility on different platforms (either your own,
or your customers
• Instant replay and reset of image snapshots
Docker containers are helping organizations achieve agility and efficiency
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .10
Docker is helping organizations
achieve agility and efficiency
1
2
Improve the speed and reliability of
software development organizations
Operate that software reliably
at a reasonable cost
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Isolation Mechanisms
• Cgroups – Metering and Limiting
• Namespaces
• Pid
• User
• Net
• Mnt
• Ipc
• User
• Layered Copy On Write Filesystems
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker flow
Docker
file
Push
Build Registry
Pull
Host
Run
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Building Images
FROM alpine
RUN apk add --update bash 
mysql-client 
openssl 
vim && 
rm -rf /var/cache/apk/*
CMD /bin/echo hello
Dockerfile
Base Image
Install Software
Default Command
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Anatomy of an Image
Base Image
Layer 1
Layer 2
Layer 3
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
What Happens?
• Base image is pulled from
registry.
• A container is created and the
next command is executed.
• The result is committed to a
layer in the image.
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Demo Images/Building
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Building Images Cont.
FROM alpine
RUN apk add --update bash 
mysql-client 
openssl 
vim && 
rm -rf /var/cache/apk/*
ADD ./script.sh /
CMD /bin/echo hello
Add a file from the local build context
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exercise
Build a Docker image from Alpine that executes:
script.sh:
#!/bin/bash
echo “hello world”
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exercise Solution
#!/bin/bash
echo “hello world”
FROM alpine
RUN apk add --update bash &&
rm -rf /var/cache/apk/*
ADD ./script.sh /
CMD /script.sh
script.sh
Dockerfile $ ls ./
Dockerfile script.sh
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Demo Docker Push
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Notes on Tags
• By default Docker uses
:latest tag.
• Docker checks for image
locally, then checks
registry.
• Always run a versioned tag
in a production system
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker Run
docker run –d nginx
docker run –it debian bash
docker logs <container id>
See the stdout/stderr from a container:
docker exec –it <container id> /bin/bash
Jump inside a container with a shell:
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exercise
Run the container from previous exercise in both interactive and
Detached mode.
Enter the detached container with docker exec
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker Run From a Filesystem perspective
Base Image
Layer 1
Layer 2
Layer 3
Container 1
Filesystem
Container 2
Filesystem
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exercise
Run 2 containers from the same image and see that changes
on the local file system do not impact the other.
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker volumes
Base Image
Layer 1
Layer 2
Layer 3
By Default layered file systems. Keep mapping
table in memory.
AUFS doesn’t do Hard Links… good luck running Tox
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker volumes
Base Image
Layer 1
Layer 2
Layer 3
Use a VOLUME
Dockerfile:
Volume /path
Runtime:
-v /path
/var/lib/docker
Filesystem
Running
Container
/path
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Volume Plugins
Docker plugin binaries that
can mount storage and
attach to containers.
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Host Bind Mounts
Directly mount any path on the host file system inside the
container.
docker run –it –v /data:/data alpine sh
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Volumes From
Share volumes between containers!
Data
Container
Container 1 Container 2
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Volume Exercises
1. Docker volume ls
2. docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
3. Docker volume ls
4. Docker volume create –name mysql-data
5. docker run --name some-mysql-named-volume -e MYSQL_ROOT_PASSWORD=my-
secret-pw –d –v mysql-data:/var/lib/mysql mysql
6. mkdir ./data
7. docker run --name some-mysql-host-volume -e MYSQL_ROOT_PASSWORD=my-secret-
pw –d –v $(pwd)/data:/var/lib/mysql mysql
8. Create a volume container
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Docker networking
• Containers run in their own
network namespace.
• Port mapping to host interface
for outside accessiblity.
Host
Interface
Docker Bridge
Container
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Demo Networking Modes
None
Host
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Linking
Creates Directional Link
Creates DNS / Host
lookup
Creates ENV variables
Container 1 Container 2
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exposing Ports
Allows traffic from
outside of the Docker
bridged network.
Host
Interface
Docker Bridge
Container
Outside world
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Demo
Linking
Setting hostname
Setting host:ip mapping
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Exercise
Create Mysql Container and link a mysql client container to it.
Run nginx container and reach port
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Pulling it all together
Lets run:
https://github.com/realpython/orchestrating-docker
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Advanced Topics
Namespace sharing!
Security Considerations
Daemon settings
© 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .
Thank you!
Questions?
Contact: mpaluru@rancher.com

More Related Content

What's hot

Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
Justin Crown
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13
kylog
 
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
dotCloud
 
Dockerfile
Dockerfile Dockerfile
Dockerfile
Jeffrey Ellin
 
Docker Started
Docker StartedDocker Started
Docker Started
Victor S. Recio
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Erica Windisch
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to docker
Guilhem Marty
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
Ganesh Samarthyam
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
Ranjit Avasarala
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
Adam Culp
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
Ruoshi Ling
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
dotCloud
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
Jessica Lucci
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
Victor S. Recio
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
Adrian Otto
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
dotCloud
 
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Ruoshi Ling
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
CodeOps Technologies LLP
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014
Puppet
 

What's hot (20)

Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13
 
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
 
Dockerfile
Dockerfile Dockerfile
Dockerfile
 
Docker Started
Docker StartedDocker Started
Docker Started
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to docker
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
 
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014
 

Viewers also liked

The IT Crowd stance on writing advice documents
The IT Crowd stance on writing advice documentsThe IT Crowd stance on writing advice documents
The IT Crowd stance on writing advice documents
Karim Vaes
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
Hamilton Turner
 
Windows Server Containers- How we hot here and architecture deep dive
Windows Server Containers- How we hot here and architecture deep diveWindows Server Containers- How we hot here and architecture deep dive
Windows Server Containers- How we hot here and architecture deep dive
Docker, Inc.
 
Inbox Zero: Action-Based Email
Inbox Zero: Action-Based EmailInbox Zero: Action-Based Email
Inbox Zero: Action-Based Email
merlinmann
 
Docker 101 in developer view
Docker 101 in developer viewDocker 101 in developer view
Docker 101 in developer view
Somkiat Puisungnoen
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
Docker, Inc.
 

Viewers also liked (6)

The IT Crowd stance on writing advice documents
The IT Crowd stance on writing advice documentsThe IT Crowd stance on writing advice documents
The IT Crowd stance on writing advice documents
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
Windows Server Containers- How we hot here and architecture deep dive
Windows Server Containers- How we hot here and architecture deep diveWindows Server Containers- How we hot here and architecture deep dive
Windows Server Containers- How we hot here and architecture deep dive
 
Inbox Zero: Action-Based Email
Inbox Zero: Action-Based EmailInbox Zero: Action-Based Email
Inbox Zero: Action-Based Email
 
Docker 101 in developer view
Docker 101 in developer viewDocker 101 in developer view
Docker 101 in developer view
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 

Similar to Austin - Container Days - Docker 101

2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
devopsdaysaustin
 
Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016
Thomas Shaw
 
Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - Jetbrains
Chris Tankersley
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
Liang Bo
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016
Chris Tankersley
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
Alper Unal
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
Geeta Vinnakota
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
Ben Hall
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
Chris Tankersley
 
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker EcosystemDocker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Van Phuc
 
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Patrick Chanezon
 
Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT
RightScale
 
Containers Intro - Copy.pptx
Containers Intro - Copy.pptxContainers Intro - Copy.pptx
Containers Intro - Copy.pptx
karthick656723
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
Jeffrey Ellin
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptx
Vipobav
 
EMC World 2016 - code.09 Introduction to the Docker Platform
EMC World 2016 - code.09 Introduction to the Docker PlatformEMC World 2016 - code.09 Introduction to the Docker Platform
EMC World 2016 - code.09 Introduction to the Docker Platform
{code}
 
Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in Prod
Josh Padnick
 
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
Shannon Williams
 

Similar to Austin - Container Days - Docker 101 (20)

2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016Containerised Testing at Demonware : PyCon Ireland 2016
Containerised Testing at Demonware : PyCon Ireland 2016
 
Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - Jetbrains
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentals
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker EcosystemDocker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
 
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
 
Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT
 
Containers Intro - Copy.pptx
Containers Intro - Copy.pptxContainers Intro - Copy.pptx
Containers Intro - Copy.pptx
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptx
 
EMC World 2016 - code.09 Introduction to the Docker Platform
EMC World 2016 - code.09 Introduction to the Docker PlatformEMC World 2016 - code.09 Introduction to the Docker Platform
EMC World 2016 - code.09 Introduction to the Docker Platform
 
Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in Prod
 
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
Running Rancher and Docker on Dev Machines - Rancher Online Meetup - May 2016
 

Recently uploaded

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 

Recently uploaded (20)

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 

Austin - Container Days - Docker 101

  • 1. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Container Days: Docker 101 October 13
  • 2. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .2 Bill Maxwell Principal Eng. @ Rancher Labs @cloudnautique bill@rancher.com #ranchermeetup
  • 3. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Agenda Docker Intro Container Basics Building Storage Networking
  • 4. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . STOP Docker Install Time https://docs.docker.com/engine/installation/
  • 5. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . VM vs Containers
  • 6. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Note: Containers ≠ microservices …but containers are a good way of packaging and delivering microservices [PS: you can still use VMs]
  • 7. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Our Goal: A Production Container Service 7 Develop Build Containerize Test Deploy/Upgrade Operate
  • 8. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Runtimes runC lxc/lxd openVZ rkt docker
  • 9. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker Containers Mantra: Build once, run anywhere • A clean and portable runtime environment for your application (or service) • No worries about missing dependencies, packages, etc during subsequent deployments • Automate testing, integration, and packaging…anything you can script • Reduce concerns around compatibility on different platforms (either your own, or your customers • Instant replay and reset of image snapshots Docker containers are helping organizations achieve agility and efficiency
  • 10. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc .10 Docker is helping organizations achieve agility and efficiency 1 2 Improve the speed and reliability of software development organizations Operate that software reliably at a reasonable cost
  • 11. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Isolation Mechanisms • Cgroups – Metering and Limiting • Namespaces • Pid • User • Net • Mnt • Ipc • User • Layered Copy On Write Filesystems
  • 12. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker flow Docker file Push Build Registry Pull Host Run
  • 13. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Building Images FROM alpine RUN apk add --update bash mysql-client openssl vim && rm -rf /var/cache/apk/* CMD /bin/echo hello Dockerfile Base Image Install Software Default Command
  • 14. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Anatomy of an Image Base Image Layer 1 Layer 2 Layer 3
  • 15. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . What Happens? • Base image is pulled from registry. • A container is created and the next command is executed. • The result is committed to a layer in the image.
  • 16. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Demo Images/Building
  • 17. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Building Images Cont. FROM alpine RUN apk add --update bash mysql-client openssl vim && rm -rf /var/cache/apk/* ADD ./script.sh / CMD /bin/echo hello Add a file from the local build context
  • 18. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exercise Build a Docker image from Alpine that executes: script.sh: #!/bin/bash echo “hello world”
  • 19. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exercise Solution #!/bin/bash echo “hello world” FROM alpine RUN apk add --update bash && rm -rf /var/cache/apk/* ADD ./script.sh / CMD /script.sh script.sh Dockerfile $ ls ./ Dockerfile script.sh
  • 20. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Demo Docker Push
  • 21. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Notes on Tags • By default Docker uses :latest tag. • Docker checks for image locally, then checks registry. • Always run a versioned tag in a production system
  • 22. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker Run docker run –d nginx docker run –it debian bash docker logs <container id> See the stdout/stderr from a container: docker exec –it <container id> /bin/bash Jump inside a container with a shell:
  • 23. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exercise Run the container from previous exercise in both interactive and Detached mode. Enter the detached container with docker exec
  • 24. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker Run From a Filesystem perspective Base Image Layer 1 Layer 2 Layer 3 Container 1 Filesystem Container 2 Filesystem
  • 25. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exercise Run 2 containers from the same image and see that changes on the local file system do not impact the other.
  • 26. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker volumes Base Image Layer 1 Layer 2 Layer 3 By Default layered file systems. Keep mapping table in memory. AUFS doesn’t do Hard Links… good luck running Tox
  • 27. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker volumes Base Image Layer 1 Layer 2 Layer 3 Use a VOLUME Dockerfile: Volume /path Runtime: -v /path /var/lib/docker Filesystem Running Container /path
  • 28. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Volume Plugins Docker plugin binaries that can mount storage and attach to containers.
  • 29. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Host Bind Mounts Directly mount any path on the host file system inside the container. docker run –it –v /data:/data alpine sh
  • 30. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Volumes From Share volumes between containers! Data Container Container 1 Container 2
  • 31. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Volume Exercises 1. Docker volume ls 2. docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql 3. Docker volume ls 4. Docker volume create –name mysql-data 5. docker run --name some-mysql-named-volume -e MYSQL_ROOT_PASSWORD=my- secret-pw –d –v mysql-data:/var/lib/mysql mysql 6. mkdir ./data 7. docker run --name some-mysql-host-volume -e MYSQL_ROOT_PASSWORD=my-secret- pw –d –v $(pwd)/data:/var/lib/mysql mysql 8. Create a volume container
  • 32. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Docker networking • Containers run in their own network namespace. • Port mapping to host interface for outside accessiblity. Host Interface Docker Bridge Container
  • 33. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Demo Networking Modes None Host
  • 34. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Linking Creates Directional Link Creates DNS / Host lookup Creates ENV variables Container 1 Container 2
  • 35. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exposing Ports Allows traffic from outside of the Docker bridged network. Host Interface Docker Bridge Container Outside world
  • 36. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Demo Linking Setting hostname Setting host:ip mapping
  • 37. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Exercise Create Mysql Container and link a mysql client container to it. Run nginx container and reach port
  • 38. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Pulling it all together Lets run: https://github.com/realpython/orchestrating-docker
  • 39. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Advanced Topics Namespace sharing! Security Considerations Daemon settings
  • 40. © 2015 Rancher Labs, Inc.© 2016 Rancher Labs, Inc . Thank you! Questions? Contact: mpaluru@rancher.com