docker.com
docker.com/tryit
registry.hub.docker.com
Virtual Machine(VM) = Virtual OS
Container = Virtual Applicaton
Run Any App, Anywhere
Virtual Machine vs Container
Virtual Machine vs Container
Containers Share the Kernel, bins/libs
Dev ♥ Ops
Contract = Docker Container = Deploy Anywhere
Pull an Image
Run a Container
Commit Image and Push
Dockerfile
# nodejs example
FROM ubuntu
MAINTAINER Michael Jackson, majgis@gmail.com
RUN apt-get install -y python-software-properties python
RUN add-apt-repository ppa:chris-lea/node.js
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y nodejs
RUN mkdir /var/www
ADD app.js /var/www/app.js
EXPOSE 1234
CMD ["/usr/bin/node", "/var/www/app.js"]
app.js
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello FED!\n");
});
// Listen on port 1234
var port = 1234
server.listen(port);
// Put a friendly message on the terminal
console.log("Server running on port " + port);
Build Dockerfile and Run
docker build -t <name> .
docker run -p 4321:1234 -d <name>
Open Source Paas
https://www.openshift.com