Successfully reported this slideshow.
Introduction to Docker
Workshop
Pini Reznik
continuousdelivery.uglyduckling.nl
Agenda
• Install Docker
• Introduction to Containers and Docker
• Workshop
• Future of Infrastructure
• Antitude
DOCKER INSTALLATION
Docker Installation
Mac
https://docs.docker.com/installation/mac/
Windows
https://docs.docker.com/installation/windows/
Ot...
INTRODUCTION TO DOCKER
Evolution of IT
Image courtesy of Docker Inc./ docker.io
Challenge of Multiple Environments
Image courtesy of Docker Inc./ docker.io
Cargo Analogy
Image courtesy of Docker Inc./ docker.io
Cargo Delivery Pipeline
Image courtesy of Docker Inc./ docker.io
Shipping Goods
Shipping with Containers
Image courtesy of Docker Inc./ docker.io
Software in Containers
Image courtesy of Docker Inc./ docker.io
Delivery Pipeline with Containers
Development
Environment
Setup
Test
Clean
Environments
Acceptance
Similarity to
Productio...
Scalability with Containers
Docker Functions
Image courtesy of Docker Inc./ docker.io
Docker and VMs
Image courtesy of Docker Inc./ docker.io
Supported Platforms
Image courtesy of Docker Inc./ docker.io
• Host
– Any Linux with kernel >3.8.x
• Container
– Same arch...
Docker Integrations and Hosting
OS Level Virtualization
ZONES
JAILS
Workload
Partitions
Docker and Puppet/Chef/Ansible
Image courtesy of Puppet Labs puppetlabs.com
Communication - Serf
Image courtesy of CoreOS coreos.com
Infrastructure - CoreOS
Image courtesy of CoreOS coreos.com
Cluster Management - Mesos
Image courtesy of typesafe.com
PaaS, Heroku style - Flynn
Image courtesy of mesosphere.io
Software Configuration Management
Done Right.
Everything (almost) we need to build our
Software is now finally in the Vers...
WORKSHOP
boot2docker
$ boot2docker init
$ boot2docker start
$ boot2docker ssh
OR
$ boot2docker init
$ boot2docker start
$ export DO...
Docker run
$ docker run ubuntu ls
$ docker run -i -t –name file -v `pwd`:/tmp/on_host -w `pwd`
ubuntu bash
touch /tmp/file...
Docker attach/stop/start
$ docker run -d -name while ubuntu /bin/sh -c "while true; do
echo hi; sleep 1; done"
$ docker at...
Docker log/inspect/ps/top
$ docker ps
$ docker ps –a
$ docker top while
$ docker logs
$ docker inspect
Docker kill/rm/rmi
$ docker kill
$ docker rm
$ docker rmi
Dockerfile
FROM ubuntu
MAINTAINER UglyDuckling "info@uglyduckling.nl"
RUN echo deb http://archive.ubuntu.com/ubuntu precis...
Docker build/tag
$ docker build -t you_name/sample .
$ docker run you_name/sample
$ docker run -i -t you_name/sample bash
...
Docker commit/pull/push (skipping)
• https://registry.hub.docker.com/
Serf
• Gossip-based membership
• Failure detection
• Custom events
Wordpress/MySQL Exercise
HOST
DOCKER
Containers
Connected
Serf agents
Based on www.centurylinklabs.com/decentralizing-dock...
Checkout and build all containers
$ git clone https://github.com/pinireznik/DockerWorkshop.git
$ cat ./build.sh
$ ./build....
Start Serf container
$ SERF_ID=$(docker run -d --name serf_1 -p 7946 -p 7373
ud/serf /run.sh)
Install and start Serf on Host
# Install Serf
$ wget dl.bintray.com/mitchellh/serf/0.5.0_linux_amd64.zip
$ unzip 0.5.0_lin...
Start MySQL container
$ MYSQL_ID=$(docker run -d --name mysql --link serf_1:serf_1 -p
3306 ud/mysql-serf /run.sh)
$ docker...
Create database
# create temporary container with MySQL client to create DB
$ docker run -t -i --name mysql_client --link ...
Start Wordpress
$ WORDPRESS_ID=$(docker run -d --name wordpress --link
serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p
80 u...
Test
# connect to the Workdpress site
$ curl --location http://$(docker port $WORDPRESS_ID 80)/
$ curl --location http://$...
Demo
• Android Development Env. in Docker container
• Jenkins in a container
• Parallel testing using multiple containers
...
FUTURE OF INFRASTRUCTURE
Evolution of IT the Next Step
App/Infra Performance Parity
Microservices
Image courtesy of martinfowler.com
Conway’s Law
organizations which design systems ... are
constrained to produce designs which are copies
of the communicati...
Network-centric organization
Image courtesy of n-e-r-v-o-u-s.com
ANTITUDE
Antitude
www.antitude.io
Antitude
• Self Healing
• Automatic Scaling
• Efficient Hardware Utilisation
DockerCon Amsterdam in November
Docker Meetups
DockerCon Amsterdam Conference in November
Docker Meetup every month
Upcoming SlideShare
Loading in …5
×

Docker workshop DevOpsDays Amsterdam 2014

2,999 views

Published on

Title: Introduction to Docker

Abstract:
During the year since it’s inception, Docker have changed our perception of the OS-level Virtualization also called Containers.
At this workshop we will introduce the concept of Linux containers in general and Docker specifically. We will guide the participants through a practical exercise that will include use of various Docker commands and a setting up a functional Wordpress/MySQL system running in two containers and communication with each other using Serf


Topics:
Docker Installation (in case is missing)
Boot2Docker
Docker commands
- basic commands
- different types of containers
- Dockerfiles
Serf
Wordpress Exercise
- setting up Serf cluster
- deploying MySQL
- deploying Wordpress and connecting to MySQL

Prerequisites:
Working installation of Docker
On Mac - https://docs.docker.com/installation/mac/
On Windows - https://docs.docker.com/installation/windows/
Other Platforms - https://docs.docker.com/installation/#installation

Published in: Software, Technology
  • Be the first to comment

Docker workshop DevOpsDays Amsterdam 2014

  1. 1. Introduction to Docker Workshop Pini Reznik continuousdelivery.uglyduckling.nl
  2. 2. Agenda • Install Docker • Introduction to Containers and Docker • Workshop • Future of Infrastructure • Antitude
  3. 3. DOCKER INSTALLATION
  4. 4. Docker Installation Mac https://docs.docker.com/installation/mac/ Windows https://docs.docker.com/installation/windows/ Other https://docs.docker.com/installation/#installation
  5. 5. INTRODUCTION TO DOCKER
  6. 6. Evolution of IT Image courtesy of Docker Inc./ docker.io
  7. 7. Challenge of Multiple Environments Image courtesy of Docker Inc./ docker.io
  8. 8. Cargo Analogy Image courtesy of Docker Inc./ docker.io
  9. 9. Cargo Delivery Pipeline Image courtesy of Docker Inc./ docker.io
  10. 10. Shipping Goods
  11. 11. Shipping with Containers Image courtesy of Docker Inc./ docker.io
  12. 12. Software in Containers Image courtesy of Docker Inc./ docker.io
  13. 13. Delivery Pipeline with Containers Development Environment Setup Test Clean Environments Acceptance Similarity to Production Production Deployments and Roll-back/forwards
  14. 14. Scalability with Containers
  15. 15. Docker Functions Image courtesy of Docker Inc./ docker.io
  16. 16. Docker and VMs Image courtesy of Docker Inc./ docker.io
  17. 17. Supported Platforms Image courtesy of Docker Inc./ docker.io • Host – Any Linux with kernel >3.8.x • Container – Same architecture as the host
  18. 18. Docker Integrations and Hosting
  19. 19. OS Level Virtualization ZONES JAILS Workload Partitions
  20. 20. Docker and Puppet/Chef/Ansible Image courtesy of Puppet Labs puppetlabs.com
  21. 21. Communication - Serf Image courtesy of CoreOS coreos.com
  22. 22. Infrastructure - CoreOS Image courtesy of CoreOS coreos.com
  23. 23. Cluster Management - Mesos Image courtesy of typesafe.com
  24. 24. PaaS, Heroku style - Flynn Image courtesy of mesosphere.io
  25. 25. Software Configuration Management Done Right. Everything (almost) we need to build our Software is now finally in the Version Control
  26. 26. WORKSHOP
  27. 27. boot2docker $ boot2docker init $ boot2docker start $ boot2docker ssh OR $ boot2docker init $ boot2docker start $ export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
  28. 28. Docker run $ docker run ubuntu ls $ docker run -i -t –name file -v `pwd`:/tmp/on_host -w `pwd` ubuntu bash touch /tmp/file_a.txt touch /tmp/on_host/file_b.txt exit $ docker diff file
  29. 29. Docker attach/stop/start $ docker run -d -name while ubuntu /bin/sh -c "while true; do echo hi; sleep 1; done" $ docker attach while $ docker stop while $ docker start while
  30. 30. Docker log/inspect/ps/top $ docker ps $ docker ps –a $ docker top while $ docker logs $ docker inspect
  31. 31. Docker kill/rm/rmi $ docker kill $ docker rm $ docker rmi
  32. 32. Dockerfile FROM ubuntu MAINTAINER UglyDuckling "info@uglyduckling.nl" RUN echo deb http://archive.ubuntu.com/ubuntu precise universe >> /etc/apt/sources.list RUN apt-get update RUN apt-get install -q -y vim ENV ENV_VAR some_stuff ADD file.txt /file.txt EXPOSE 8080 CMD ["bash", "-c", "ls", "/"]
  33. 33. Docker build/tag $ docker build -t you_name/sample . $ docker run you_name/sample $ docker run -i -t you_name/sample bash ls /file.txt exit
  34. 34. Docker commit/pull/push (skipping) • https://registry.hub.docker.com/
  35. 35. Serf • Gossip-based membership • Failure detection • Custom events
  36. 36. Wordpress/MySQL Exercise HOST DOCKER Containers Connected Serf agents Based on www.centurylinklabs.com/decentralizing-docker-how-to-use-serf-with-docker/
  37. 37. Checkout and build all containers $ git clone https://github.com/pinireznik/DockerWorkshop.git $ cat ./build.sh $ ./build.sh
  38. 38. Start Serf container $ SERF_ID=$(docker run -d --name serf_1 -p 7946 -p 7373 ud/serf /run.sh)
  39. 39. Install and start Serf on Host # Install Serf $ wget dl.bintray.com/mitchellh/serf/0.5.0_linux_amd64.zip $ unzip 0.5.0_linux_amd64.zip $ sudo mv serf /usr/bin/ # Start local agent and connect to the first Serf agent $ serf agent & $ serf join $(docker port $SERF_ID 7946)
  40. 40. Start MySQL container $ MYSQL_ID=$(docker run -d --name mysql --link serf_1:serf_1 -p 3306 ud/mysql-serf /run.sh) $ docker logs $MYSQL_ID # locate the password in docker logs and set env. variable. $ DB_PASSWORD=v6Dax72kQzQR
  41. 41. Create database # create temporary container with MySQL client to create DB $ docker run -t -i --name mysql_client --link mysql:mysql -p 3306 ud/mysql-serf bash # create DB from inside container mysql -uadmin -p$DB_PASSWORD -h $MYSQL_PORT_3306_TCP_ADDR -P 3306 -e "create database wordpress;"
  42. 42. Start Wordpress $ WORDPRESS_ID=$(docker run -d --name wordpress --link serf_1:serf_1 -e="DB_PASSWORD=$DB_PASSWORD" -p 80 ud/wordpress-serf /run.sh)
  43. 43. Test # connect to the Workdpress site $ curl --location http://$(docker port $WORDPRESS_ID 80)/ $ curl --location http://$(docker port $WORDPRESS_ID 80)/ readme.html # kill DB and see what happens $ docker kill mysql $ curl --location http://$(docker port $WORDPRESS_ID 80)/
  44. 44. Demo • Android Development Env. in Docker container • Jenkins in a container • Parallel testing using multiple containers • Django in a container • Java development in a container
  45. 45. FUTURE OF INFRASTRUCTURE
  46. 46. Evolution of IT the Next Step
  47. 47. App/Infra Performance Parity
  48. 48. Microservices Image courtesy of martinfowler.com
  49. 49. Conway’s Law organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations
  50. 50. Network-centric organization Image courtesy of n-e-r-v-o-u-s.com
  51. 51. ANTITUDE
  52. 52. Antitude www.antitude.io
  53. 53. Antitude • Self Healing • Automatic Scaling • Efficient Hardware Utilisation
  54. 54. DockerCon Amsterdam in November Docker Meetups
  55. 55. DockerCon Amsterdam Conference in November Docker Meetup every month

×