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 in 30 minutes

462 views

Published on

This talk is aimed at technical people who have heard of Docker but not used it yet.

Docker is the new way to package, distribute and run your application or microservice. It's the bees-knees. It's the best thing since sliced bread. It's the kings pajamas etc, etc. In this short but packed talk I'll explain what Docker actually is and how it works. I'll show you how much of the hype is real and give a practical demo or two to illustrate the power of Docker. Is Docker the panacea for all ills? This talk will help you make up your mind.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Docker in 30 minutes

  1. 1. in 30 mins Steve Poole, IBM @spoole167
  2. 2. the promise
  3. 3. Ship a complicated software environment that leaves no trace when finished… Be total confident that if it works for me it will work the same for you https://localhost:9043/ibm/console/logon.jsp docker run --name test -h test -v $(pwd)/PASSWORD:/tmp/PASSWORD -p 9043:9043 -p 9443:9443 -d ibmcom/websphere-traditional:install
  4. 4. The basics
  5. 5. Docker Engine Server (Long running Daemon) Host (linux) REST API CLI You Image Image UI Registry
  6. 6. Docker Engine Server (Long running Daemon) Host (not linux) REST API CLI You Image Image UI VM (linux) Registry
  7. 7. Docker Engine DaemonAPI You Image Image Host Registry
  8. 8. Docker Engine Daemon Host API You Image Image docker run -d –p 8080:80 presentation Registry
  9. 9. Docker Engine Daemon Host API You Image Image Registry Presentation Image cache Container 8080 :8080 :80
  10. 10. docker run -d –p 8080:80 presentation docker run -d –p 8081:80 presentation docker ps
  11. 11. quick check • Images are the unit of delivery. You only share images • Images are immutable • Images are stored in local caches or shared via registries. • DockerHub is a central point Think “github” for docker images • Containers are the runtime units. They run on a single host • Containers retain state until terminated • Containers are the unit of scale. • docker ps lists the running containers • docker ps -a lists all containers
  12. 12. Let’s build a Docker Image
  13. 13. docker build -t presentation .
  14. 14. Docker images are layers in a union file system. Each layer overlays the ones before: presentation eboraas/apache eboraas/debian eboraas/debootstrap
  15. 15. Dockerfile - automated image creation FROM eboraas/apache COPY ./DockerIn30Minutes /var/www/html Where’s the command to run the apache server? I inherited it
  16. 16. FROM eboraas/debian:stable MAINTAINER Ed Boraas <ed@boraas.ca> RUN apt-get update && apt-get -y install apache2 && apt-get clean && rm -rf /var/lib/apt/lists/* ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 RUN /usr/sbin/a2ensite default-ssl RUN /usr/sbin/a2enmod ssl EXPOSE 80 EXPOSE 443 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
  17. 17. quick check • Dockerfiles are the normal way to create docker images. • Usually: • has a name of image to inherit from • has a set of build instructions to run at build time • has some runtime instruction (ie what to start)
  18. 18. Docker Engine Daemon Host API You Image Image Registry Presentation Image cache Container 8080 :8080 :80
  19. 19. Docker Engine Daemon Host API You Image Image Registry pres Image cache Container 8080 Container 8081 apach e debian
  20. 20. Volumes • Think of containers as mini VM’s • Any mutations made to the containers contents will be lost when the container is stopped • How to share or persist state? • Two options..
  21. 21. docker run -d -v $PWD:/var/www/html p 8082:80 —t presentation Think of as an nfs mount style command mounts a local directory on the host over the top of a directory in the container Both directory paths must be absolute The container can read/write the contents of the host file system -v
  22. 22. VOLUME command VOLUME /data Dockerfile command to create a persistent data store on the host system that is accessed inside the container at the path given. Volumes persist on the host until deleted. Volumes are a great way to share state between containers docker run -d —volumes-from container image auto magically mount the volumes created by another container
  23. 23. Docker Engine Daemon Host API You Image Image Registry pres Image cache Container 8080 Container 8081 apach e debian
  24. 24. It’s getting messy • Let me introduce kitematic
  25. 25. Advanced section • Docker for encapsulating a single instance of a complex environment is useful • Docker as the packing and deployment of an single micro service is compelling • Docker tools exist to network containers together and to scale and load balance across multiple hosts and data centres. • Containerisation is the enabler for industrial application deployments on truly gigantic scales.
  26. 26. Docker compose • “Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration” • https://docs.docker.com/compose/overview/
  27. 27. version: '2' services: dbserver: image: couchdb ports: - "5984:5984" volumes: - ./.couchsummary:/usr/local/var/lib/couchdb dbteam: image: couchdb ports: - "5985:5984" volumes: - ./.couchteam:/usr/local/var/lib/couchdb teamserver: image: dashboard build: . command: bundle exec rackup -s puma -p 8080 volumes: - .:/dashboard ports: - "80:8080" depends_on: - dbteam environment: MODE: team TEAM: test DBURL: http://dbteam:5984/
  28. 28. There’s more - but thats for another talk thank you.

×