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.

From zero to Docker

282 views

Published on

This is a simple presentation I held about Docker in the Linux User Group of my town.

Published in: Software
  • Be the first to comment

  • Be the first to like this

From zero to Docker

  1. 1. From zero to Docker Giovanni Toraldo @ LuccaLUG
  2. 2. Docker: what is it? Enables software developers to: ● package an application ● with all dependencies ● runs it everywhere unchanged
  3. 3. Docker: what is it? Enables system administrators to ● simplify application deployment ● ease scale-up & scale-down ● processes separation
  4. 4. Underlying technologies ● Linux namespaces ● Control Groups (cgroups) ● Layered filesystems ● LXC (now libcontainer)
  5. 5. Glossary ● Image: immutable snapshot of a container, push/pull repository ● Container: an instance launched from an image ● Volume: persistent writable area of a container ● Registry: repository of images (versioned via tags) ● Dockerfile: the descriptor from which an image is built
  6. 6. How to install docker engine ● GNU/Linux deb https://apt.dockerproject.org/repo ubuntu-trusty main deb https://apt.dockerproject.org/repo debian-jessie main pacman -S docker ● Windows / OSX https://www.docker.com/products/docker-toolbox
  7. 7. Docker-machine Machine manager (like Vagrant) https://github.com/docker/machine (Win/Mac: distributed in Docker toolkit) ● Launch VM somewhere ● Install Docker ● Generates and copy certificates ○ (password-less auth) ● Enable remote access via TCP
  8. 8. Docker-machine backends Where nodes can run? ● Generic backend ○ existing hosts with ssh access ● Local machine (virtualization) ○ Virtualbox ○ VMware Fusion ● Cloud providers ○ Amazon ○ GCE ○ Rackspace ○ DigitalOcean ○ ...
  9. 9. Docker-machine bootstrap examples $ docker-machine create --driver generic --generic-ip-address=<ip-address> <nodename> $ docker-machine create --driver virtualbox <nodename> $ docker-machine create --driver digitalocean --digitalocean-access-token <token> <nodename> $ docker-machine create --driver amazonec2 --amazonec2-access-key <key> -- amazonec2-secret-key <secret> <nodename> $ docker-machine create --driver kvm --kvm-cpu-count 2 --kvm-disk-size 20 --kvm- memory 4096 <nodename>
  10. 10. Interaction with a Docker-machine node $ docker-machine env default export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/home/gionn/.docker/machine/machines/default" export DOCKER_MACHINE_NAME="default" # Run this command to configure your shell: # eval "$(docker-machine env default)" $ docker info Kernel Version: 4.1.17-boot2docker Operating System: Boot2Docker 1.10.0 (TCL 6.4.1); master : b09ed60 - Thu Feb 4 20:16:08 UTC 2016
  11. 11. Hello world $ docker run -ti ubuntu:14.04 /bin/bash ● Live demo time
  12. 12. What happens under the hood? ● Pulls the ubuntu image from registry ● Creates a new container ○ Allocates a rw filesystem ○ Allocates a network interface (on a bridge) ○ Sets up network (IP address, dns..) ● Launch a process in the container ● Captures and provides application output Container terminates when the process exit
  13. 13. Dockerfile (not the best example)
  14. 14. Standard workflow Build & push: ● docker build -t gionn/nodejs-app:1.0.0 . ○ a tagged image is generated ● docker push gionn/nodejs-app:1.0.0 ○ publish to repository Pull & run: ● docker pull gionn/nodejs-app:1.0.0 ○ fetch from repository ● docker run gionn/nodejs-app:1.0.0 ○ run container from this image
  15. 15. Docker compose Compose is a tool for defining and running multi-container Docker applications using a file in YML format. $ docker-compose up Examples: https://github.com/ClouDesire/docker-compose-library
  16. 16. Thanks!

×