SlideShare une entreprise Scribd logo
1  sur  40
© 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

Contenu connexe

Tendances

Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker ComposeJustin 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-13kylog
 
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-05dotCloud
 
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) - DevopsDaysPGHErica Windisch
 
First steps to docker
First steps to dockerFirst steps to docker
First steps to dockerGuilhem Marty
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam 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 CochranedotCloud
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to DockerAdrian Otto
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQdotCloud
 
當專案漸趕,當遷移也不再那麼難 (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
 
Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Using Docker with Puppet - PuppetConf 2014
Using Docker with Puppet - PuppetConf 2014Puppet
 

Tendances (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
 

En vedette

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 documentsKarim Vaes
 
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 diveDocker, Inc.
 
Inbox Zero: Action-Based Email
Inbox Zero: Action-Based EmailInbox Zero: Action-Based Email
Inbox Zero: Action-Based Emailmerlinmann
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 

En vedette (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
 

Similaire à 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 Productiondevopsdaysaustin
 
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 2016Thomas Shaw
 
Docker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsDocker for PHP Developers - Jetbrains
Docker for PHP Developers - JetbrainsChris Tankersley
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016From Docker to Production - ZendCon 2016
From Docker to Production - ZendCon 2016Chris Tankersley
 
Docker fundamentals
Docker fundamentalsDocker fundamentals
Docker fundamentalsAlper Unal
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDocker, Inc.
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta 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 2016Ben Hall
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Chris 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 EcosystemVan 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.pptxkarthick656723
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptxVipobav
 
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 ProdJosh 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 2016Shannon Williams
 

Similaire à 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
 

Dernier

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
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...DianaGray10
 
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 challengesrafiqahmad00786416
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 SavingEdi Saputra
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
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 connectorsNanddeep Nachan
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 

Dernier (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

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