Getting Started With Docker
Getting Started With Docker
February 5, 2015
David Carew
IT Architect
Ecosystem Development
2
#Bluemix
The Challenge
3
#Bluemix
The Matrix From Hell
4
#Bluemix
Cargo Transport Pre-1960
5
#Bluemix
Solution: Intermodal Shipping Container
6
#Bluemix
Docker is a shipping container system for code
7
#Bluemix
Docker eliminates the matrix from Hell
8
#Bluemix
Why it works –separation of concerns
9
#Bluemix
Containers vs VMs
10
#Bluemix
More on Containers
A Docker container consists of an operating system,
user-added files, and meta-data – Basically a way to
run mini operatingsystems in your host operating
system with strong guarantees of isolation !
11
#Bluemix
Why are Docker containers lightweight ?
12
#Bluemix
What are the basics of a Docker system ?
13
#Bluemix
Changes and Updates
14
#Bluemix
Client Server Architecture on different platforms
Native Linux (eg Ubuntu) Windows via boot2docker* Mac via boot2docker Windows/Mac via VM
docker-client docker-client
docker-daemon VirtualBox VM
Tiny Core Linux
docker-daemon docker-daemon
docker-daemon
containers
containers
containers containers
15
#Bluemix
Docker Images, Dockerfile and Docker Registry
Docker images are read-only templates from which
Docker containers are launched.
16
#Bluemix
Bluemix Container Service
Currently Experimental
Docker environment for running Docker containers
• Tenant private registry + read only public registry
– Currently 2 public images
• Node.js and WAS Liberty
• Both on an Ubuntu 14.04 base
• Containers can access Bluemix Services
– Can inject service metadata into Container’s ENV
• Command extensions provided for Bluemix specific tasks (e.g. bind a container to an
app’s services)
– Command extensions not supported on boot2docker on Windows
• Use Linux VM instead
• Provides public IPs that can be mapped to specific containers
– Only ports 22, 80, 443, 9080, and 9443 can be accessed
17
#Bluemix
Demo
Running Shiny+RHRV on Bluemix via a Docker container
• BD&A Days demo has a Bluetooth heart monitor than transmits ECG data into the
DashDB service in Bluemix
– R packages, RHRV and Shiny allow analytics and visualization of that data
• Current Bluemix/Cloud Foundry Warden containers don’t support RHRV and Shiny
» A very complex setup requiring a lot of dependencies
• Using Bluemix Container service we are building a Docker image to run Shiny+RHRV and point to the
DashDB data
» Shows the value of Docker – very complex setup reduced to a single Dockerfile
18
#Bluemix
Dockerfile for Shiny+RHRV Part 1
FROM ubuntu:14.04
# Install R
RUN \
…
# Define working directory
WORKDIR /data
# SSH
RUN apt-get update && apt-get install -y openssh-server && mkdir -p /var/run/sshd
COPY authorized_keys /root/.ssh/
19
#Bluemix
Dockerfile for Shiny+RHRV Part 2
# Install shiny server
RUN
…
# Ports used
EXPOSE 22 80
20
#Bluemix
Resources
IBM Bluemix Container Service video
• https://www.youtube.com/watch?v=-fcMeHdjC2g
IBM Bluemix Container docs
• https://www.ng.bluemix.net/docs/#services/Containers/index.html
Docker documentation
• https://docs.docker.com/
21
#Bluemix