SlideShare a Scribd company logo
Introduction to Docker
What is it? And Why Should I Care?
PRESENTATION BY: ALAN FORBES
Am I in the right place?
Meet Today’s Presenter
Alan Forbes
Vice President of Product Management
aforbes@rprwyatt.com
Proud IBMAdvanced Business
Partners for
18Years
Agenda - Docker
• What it is
• How it works
• Turbo Demo!
• Why you should care
What is Docker?
In jargon, it’s a software container platform
It provides abstraction of operating system level virtualization
What’s in a container?
• The operating system
• Your software
• The dependencies required to run your
software (PHP, Mongo, mySQL,
Python, Apache, Node, etc.)
• Environment variables
• Your code
• more
What problem does Docker solve?
• It runs on my machine, but not on yours…
• Don’t run it on your machine, run it in a container. Then when you share the container, it will work
• Specifically, Docker makes it possible to set up local development environments that are exactly like a live
server
• Also solves the issue of getting more out of existing hardware
Buil
d
Ship Run
Container vs VM (words)
• A virtual machine will include the application, the necessary binaries
and libraries, and an entire operating system (many GBs)
• A Docker container also contains the application and necessary
libraries, but shares the OS kernel with other containers.
• Docker containers run in an isolated process space.
• Guest OS layer is completely eliminated.
• Docker Engine can set on top of Linux, Mac,Windows, Azure, AWS,
etc.
Containers vs Virtual Machine (visual)
Every container shares the core
• With traditionalVMs you can mix and match OS
• This is super flexible, but hardware heavy
• Resources are allocated at provision time
• With Docker, all the containers run on top of same operating system
and kernel.
• If multiple copies of the same application are what you want, then you'll love
containers.
• Docker gets the most server application instances running on the least amount
of hardware
Which OS is shared?
• Docker can run on Mac,Windows, Linux
• The Docker Engine shared OS is a flavor of Linux
• In general, Docker containers run Linux (even when running on
Windows)
• However… onWindows Server 2016 andWindows 10 (Anniversary
Edition) only you can runWindows server containers, which allow for
.NET, ASP.NET, PowerShell, etc.
• Nano server, .NET Core
Containers can run almost anywhere
• Desktop - Mac andWindows
• Cloud Providers
• IBM Bluemix
• AWS
• Azure
• Servers
• CentOS, Debian, Fedora
• Oracle Linux, Red Hat, Ubuntu, etc
But my software isn’t quite done…
• Software is never finished
• Dependencies change over time
• Docker thought of this. It has “git like” versioning to track successive versions of a
container, inspect the differences between versions, commit new versions, roll back, etc.
• Who made that change and when?
• Incremental changes (download just the differences, not a new container)
Build Ship Run
Component Reuse
• Any container can be saved as a “base image”
from which other containers can be built.
• Containers can be built on top of each other
(will explain).
• The best part is that these containers can be
created as part of an automated script.
Getting started – www.docker.com
Simple Dockerfile – Image Definition
FROM php:7.0-apache
COPY src/ /var/www/html/
EXPOSE 80
• Note we don’t have to start from scratch; we’re building on top of
an existing image pre-configured with PHP and Apache
FROM the Public Repository @ Hub.docker.com
How to use the image
Containers are stacked
• 3 line docker file, starts with FROM
• Docker pulled an image from the public
repository
• That image also contains a From,
which may contain another
• FROM debian:jessie
• FROM scratch
Add our code: Hello World
<?php
Echo "hello Social Connections! Today is ". date('l jS of FY h:i:s A'); ?>
Run command:
docker run -p 80:80 -v /Users/alan/docker/src/:/var/www/html hello-
world
All files copied to the container
• A container is an instance of the image
• But if a source file changes, you have to stop and rebuild the
container (Deploy)
• Unless you mount a volume; in this case the files are not part of the
container (Dev)
Life of a container
• The container will run until the main process stops
• In our case, if PHP crashes
• The life of a container is tied to a single process
• Thus, try to keep containers to a single main process
• Rather than run PHP and my SQL on a single container, run two
containers
• You can stop them manually with ctrl-c
Basic Docker Commands
• docker run <image> - creates a new container based on an image
• docker start <name | ID> - starts an existing container
• docker stop <name | ID> - stops an existing, running container
• docker ps - list all containers [-a include all containers, even stopped
ones]
• docker rm <name | ID> - deletes a container
Quick Review
• Installed Docker
• Found a suitable image on Docker hub
• An image is a text file describing what goes into a container
• Created a container using that image PLUS our own code
• A container is an instance of an image
• Built the container and ran it
• Files change – either rebuild the container or “mount” a volume
instead
• Limit containers to a single process / purpose
Docker Compose
• Each container should provide a single service
• An app may need several containers that need to work together
• Keeping track of the status of multiple containers can be a pain in a
complex application (lots of command line parameters)
• Docker Compose allows you to start and stop groups of containers
as one unit
The scenario – 2 related containers
• Web page running onApache
• Web API running some scripting language (Python, PHP, etc)
docker-compose.yml
• SeeVisual Code
Real life plus a shameless plug 
The scenario – 3 related containers
• Apache with PHP plus custom code
• mySQL
• phpMyAdmin
docker-compose.yml
Add mySQL
docker-compose up
So why should I care?
• At first, I thought to myself “I already know enough technology, how
could this thing possibly matter?”
• BUT… it does matter:
• Docker is a better solution for many problems
• It’s pretty easy to learn
• IBM is adopting it like crazy, as are many other companies
• It’s cool and hip… like you
• It’s significantly faster - MongoDB (5 steps or 1?)
IBM & Docker Together
• Docker Subscription for IBM
• DockerTrusted Registry: Dedicated image store and distribution
service deployed behind your firewall
• Docker Engine: Push/pull images, build and run containers
• IBM Level 1 and 2 support
• Integrated with UrbanCode Deploy for integrated release
management
Docker is a big deal
Thank you!
• Questions? Come visit my booth!
• aforbes@rprwyatt.com

More Related Content

Introduction to Docker

  • 1. Introduction to Docker What is it? And Why Should I Care? PRESENTATION BY: ALAN FORBES
  • 2. Am I in the right place?
  • 3. Meet Today’s Presenter Alan Forbes Vice President of Product Management aforbes@rprwyatt.com Proud IBMAdvanced Business Partners for 18Years
  • 4. Agenda - Docker • What it is • How it works • Turbo Demo! • Why you should care
  • 5. What is Docker? In jargon, it’s a software container platform It provides abstraction of operating system level virtualization
  • 6. What’s in a container? • The operating system • Your software • The dependencies required to run your software (PHP, Mongo, mySQL, Python, Apache, Node, etc.) • Environment variables • Your code • more
  • 7. What problem does Docker solve? • It runs on my machine, but not on yours… • Don’t run it on your machine, run it in a container. Then when you share the container, it will work • Specifically, Docker makes it possible to set up local development environments that are exactly like a live server • Also solves the issue of getting more out of existing hardware Buil d Ship Run
  • 8. Container vs VM (words) • A virtual machine will include the application, the necessary binaries and libraries, and an entire operating system (many GBs) • A Docker container also contains the application and necessary libraries, but shares the OS kernel with other containers. • Docker containers run in an isolated process space. • Guest OS layer is completely eliminated. • Docker Engine can set on top of Linux, Mac,Windows, Azure, AWS, etc.
  • 9. Containers vs Virtual Machine (visual)
  • 10. Every container shares the core • With traditionalVMs you can mix and match OS • This is super flexible, but hardware heavy • Resources are allocated at provision time • With Docker, all the containers run on top of same operating system and kernel. • If multiple copies of the same application are what you want, then you'll love containers. • Docker gets the most server application instances running on the least amount of hardware
  • 11. Which OS is shared? • Docker can run on Mac,Windows, Linux • The Docker Engine shared OS is a flavor of Linux • In general, Docker containers run Linux (even when running on Windows) • However… onWindows Server 2016 andWindows 10 (Anniversary Edition) only you can runWindows server containers, which allow for .NET, ASP.NET, PowerShell, etc. • Nano server, .NET Core
  • 12. Containers can run almost anywhere • Desktop - Mac andWindows • Cloud Providers • IBM Bluemix • AWS • Azure • Servers • CentOS, Debian, Fedora • Oracle Linux, Red Hat, Ubuntu, etc
  • 13. But my software isn’t quite done… • Software is never finished • Dependencies change over time • Docker thought of this. It has “git like” versioning to track successive versions of a container, inspect the differences between versions, commit new versions, roll back, etc. • Who made that change and when? • Incremental changes (download just the differences, not a new container) Build Ship Run
  • 14. Component Reuse • Any container can be saved as a “base image” from which other containers can be built. • Containers can be built on top of each other (will explain). • The best part is that these containers can be created as part of an automated script.
  • 15. Getting started – www.docker.com
  • 16. Simple Dockerfile – Image Definition FROM php:7.0-apache COPY src/ /var/www/html/ EXPOSE 80 • Note we don’t have to start from scratch; we’re building on top of an existing image pre-configured with PHP and Apache
  • 17. FROM the Public Repository @ Hub.docker.com
  • 18. How to use the image
  • 19. Containers are stacked • 3 line docker file, starts with FROM • Docker pulled an image from the public repository • That image also contains a From, which may contain another • FROM debian:jessie • FROM scratch
  • 20. Add our code: Hello World <?php Echo "hello Social Connections! Today is ". date('l jS of FY h:i:s A'); ?> Run command: docker run -p 80:80 -v /Users/alan/docker/src/:/var/www/html hello- world
  • 21. All files copied to the container • A container is an instance of the image • But if a source file changes, you have to stop and rebuild the container (Deploy) • Unless you mount a volume; in this case the files are not part of the container (Dev)
  • 22. Life of a container • The container will run until the main process stops • In our case, if PHP crashes • The life of a container is tied to a single process • Thus, try to keep containers to a single main process • Rather than run PHP and my SQL on a single container, run two containers • You can stop them manually with ctrl-c
  • 23. Basic Docker Commands • docker run <image> - creates a new container based on an image • docker start <name | ID> - starts an existing container • docker stop <name | ID> - stops an existing, running container • docker ps - list all containers [-a include all containers, even stopped ones] • docker rm <name | ID> - deletes a container
  • 24. Quick Review • Installed Docker • Found a suitable image on Docker hub • An image is a text file describing what goes into a container • Created a container using that image PLUS our own code • A container is an instance of an image • Built the container and ran it • Files change – either rebuild the container or “mount” a volume instead • Limit containers to a single process / purpose
  • 25. Docker Compose • Each container should provide a single service • An app may need several containers that need to work together • Keeping track of the status of multiple containers can be a pain in a complex application (lots of command line parameters) • Docker Compose allows you to start and stop groups of containers as one unit
  • 26. The scenario – 2 related containers • Web page running onApache • Web API running some scripting language (Python, PHP, etc)
  • 28. Real life plus a shameless plug 
  • 29. The scenario – 3 related containers • Apache with PHP plus custom code • mySQL • phpMyAdmin
  • 33. So why should I care? • At first, I thought to myself “I already know enough technology, how could this thing possibly matter?” • BUT… it does matter: • Docker is a better solution for many problems • It’s pretty easy to learn • IBM is adopting it like crazy, as are many other companies • It’s cool and hip… like you • It’s significantly faster - MongoDB (5 steps or 1?)
  • 34. IBM & Docker Together • Docker Subscription for IBM • DockerTrusted Registry: Dedicated image store and distribution service deployed behind your firewall • Docker Engine: Push/pull images, build and run containers • IBM Level 1 and 2 support • Integrated with UrbanCode Deploy for integrated release management
  • 35. Docker is a big deal
  • 36. Thank you! • Questions? Come visit my booth! • aforbes@rprwyatt.com

Editor's Notes

  1. https://www.youtube.com/watch?v=YFl2mCHdv24