Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker Introduction

24,233 views

Published on

Short Introduction to Docker. These slides show the basic idea behind the container technology Docker. The slides present the basic features for the daily use with Docker, Docker Compose, Docker Machine and Docker Swarm.
Docker is specially important for DevOps, because it gives Software Developers more control about their dependencies in different environments.

Published in: Software

Docker Introduction

  1. 1. Who I am? • Robert Reiz • Software Developer • I started VersionEye • Software Dev since 1998
  2. 2. Started 2009 DevOps Days in Belgium
  3. 3. DevOps is all about working together. About agile Infrastructure. Youbuildit.Yourunit.Youtakeresponsibilityforit!
  4. 4. Shipment without Containers
  5. 5. 1956 Malcom McLean introduced the 40’Container - ISO 668. > 15 Million inst. 2/3 of global trade run over 40’Containers!
  6. 6. The Logistic Problem
  7. 7. Same Problem in Software Dev.
  8. 8. Java ? ? ? Ruby ? ? ? Node.JS ? ? ? MySQL ? ? ? Dev-Env. Test-Env. Prod-Env.
  9. 9. Java JKD 1.8.14 - Win32 JKD 1.8.1 - Lnx-64 JDK 1.7-patch UNX Ruby 2.2.2 rvm 2.2.1 nat MRI 2.1.0 rubinius Node.JS 4.0 win 4.0 Linux 4.0 Linux MySQL 5.5 win 5.0 Linux 5.0 Linux Dev-Env. Test-Env. Prod-Env.
  10. 10. Java .WAR / .EAR .WAR / .EAR .WAR / .EAR Ruby GEM / GIT GEM / GIT GEM / GIT Node.JS ZIP / GIT ZIP / GIT ZIP / GIT MySQL .dmg .exe .dep Dev-Env. Test-Env. Prod-Env.
  11. 11. Java Ruby Node.JS MySQL Dev-Env. Test-Env. Prod-Env.
  12. 12. What is Docker?
  13. 13. What is Docker? ❖ Open Source Project started in March 2013 ❖ From the makes of dotCloud (PaaS). ❖ Received $162 Million Funding. ❖ Community grows rapidly!
  14. 14. What is Docker? ❖ Tiny VM (25 MB) ❖ Linux based - LXC Interface / libcontainer ❖ Own Namespaces and Cgroups! ❖ Shared resources with host system. ❖ It doesn’t work natively on Windows! Not yet!
  15. 15. Build - Ship - Run Docker-Hub Build RUN RUN RUN docker push docker pull Server Farm Production
  16. 16. Build
  17. 17. Dockerfile FROM ubuntu:14.10 MAINTAINER Robert Reiz <reiz@versioneye.com> ENV LANG en_US.UTF-8 RUN apt-get update RUN apt-get install -y --force-yes -q nginx ADD nginx.conf /etc/nginx/nginx.conf CMD nginx EXPOSE 80
  18. 18. Build - Dockerfile > docker build -t reiz/nginx:1.0.0 . docker image => reiz/nginx:1.0.0
  19. 19. Ship
  20. 20. Ship Docker Image > docker push reiz/nginx:1.0.0
  21. 21. Run
  22. 22. Fetch a Docker Image > docker pull reiz/nginx:1.0.0 Download docker image reiz/nginx:1.0.0 from Docker Hub to local Docker repository.
  23. 23. Run a Docker Container > docker run reiz/nginx:1.0.0 Creates a Docker container out of the Docker image reiz/nginx:1.0.0. It runs the nginx process.
  24. 24. More Commands > docker stop <container_id> > docker start <container_id> > docker top <container_id> > docker logs <container_id> > docker rm <container_id>
  25. 25. Important ❖ A Docker Container doesn’t store state! ❖ You can not ssh into a Docker Container! ❖ A container is supposed to run 1 process!
  26. 26. Shell
  27. 27. Get a Shell > docker run -it reiz/mongodb:1.0.2 /bin/bash Starts a new Docker container with an active shell.
  28. 28. Get a Shell > docker exec -it mongodb /bin/bash Executes a command on a running contianer
  29. 29. Volumes
  30. 30. Mount a Volume > docker run -v/mnt/mongodb:/data -d reiz/mongodb:1.0.2 Mounts “/mnt/mongodb” directory into the Docker container as “/data”. Keep the data on the host. That’s how you keep data persisted.
  31. 31. Environment Variables
  32. 32. Set environment variables > docker run --envLANG=en_US.UTF-8 -d reiz/mongodb:1.0.2 You can overwrite ENV variables from the Dockerfile here and also define completely new ones.
  33. 33. Links
  34. 34. Link Docker Containers > docker run —name mongodb -d versioneye/mongodb:1.0.2 > docker run —linkmongodb:mongo versioneye/api:1.0.0 MONGO_PORT=tcp://172.1.10.1:27017 MONGO_PORT_27017_TCP=tcp://172.1.10.1:27017 MONGO_PORT_27017_TCP_ADDR=172.1.10.1 MONGO_PORT_27017_TCP_PORT=27017 MONGO_PORT_27017_TCP_PROTO=tcp Environmentvariablesareinjectedin2ndcontainer:
  35. 35. DEMO
  36. 36. Docker Compose api: image: versioneye/rails_api:2.5.7 ports: - "9090:9090" container_name: "api" links: - mongodb:db - elasticsearch:es mongodb: image: reiz/mongodb:2.6.6_2 container_name: “mongodb" elasticsearch: image: reiz/elasticsearch:0.9.1 container_name: "elasticsearch" docker-compose.yml describes a whole set of Docker containers
  37. 37. Docker Compose > docker-compose up -d > docker-compose ps > docker-compose stop
  38. 38. Docker Compose > docker-compose build api > docker-compose up --no-deps -d api Updating a single container, not ALL of them.
  39. 39. Docker Compose > docker-compose scale worker=3 Scaling up containers
  40. 40. DEMO
  41. 41. Docker Machine > docker-machine create --driver virtualbox dev Docker Machine: create, manage and remote control docker machines/hosts. BETA
  42. 42. Docker Machine > docker-machine ls > eval "$(docker-machine env dev)" > docker ps
  43. 43. DEMO
  44. 44. Docker Swarm DockerNode DockerNode DockerNode DockerMaster DockerSwarm DockerClient docker run ServiceDiscovery BETA
  45. 45. Continuous Testing with Docker Containers
  46. 46. Storage Driver ❖ AUFS ❖ devicemapper
  47. 47. DON’TUSE DEVICEMAPPER!
  48. 48. Link Docker Containers Linking only works on same hosts!
  49. 49. Service Discovery
  50. 50. Service Discovery ❖ Environment Variables ❖ Mount configuration via volumes ❖ Use a service like: etcd, zookeeper etc…
  51. 51. Orchestration
  52. 52. Docker Orchestration ❖ Docker Swarm ❖ CM-Tools (Chef, Puppet, Ansible, Salt) ❖ Kubernetes ❖ Mesos
  53. 53. ? ? ? @RobertReiz https://www.versioneye.com/go/docker:docker

×