Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker Meetup Frankfurt 2015: Docker Orchestration

Docker Meetup Frankfurt 2015: Docker Orchestration

**Docker orchestration talk**

Here you can find my docker slide deck container from my [Docker Meetup Frankfurt - Docker Orchestration ][1] talk.

- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:mfrankfurt2015`
- open your browser with `http :8000/docker-orchestration`
- pdf [Docker Orchestration][2] is now avaiable!

Feedback welcome

[Peter Rossbach][3]

[1]: http://www.meetup.com/Docker-Frankfurt/events/219160756/
[2]: https://speakerdeck.com/rossbachp/docker-meetup-frankfurt-2015-docker-orchestration
[3]: http://twitter.com/PRossbach

Peter Rossbach

January 14, 2015
Tweet

More Decks by Peter Rossbach

Other Decks in Programming

Transcript

  1. 16 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    cd ~/bin ln -s docker-1.4.1-136b351e-identity docker ln -s machine_darwin_amd64 docker-machine chmod +x docker chmod +x docker-machine export PATH=~/bin:$PATH export DYLD_LIBRARY_PATH="" export LD_LIBRARY_PATH=""
  2. 17 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    git clone https://github.com/docker/machine.git cd machine boot2docker start boot2docker shellinit script/build -osarch="darwin/amd64" cp machine_darwin_amd64 ~/bin/
  3. 18 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ cd ~/bin $ mkdir -p ~/.docker $ docker-1.4.1-136b351e-identity $ ls ~/.docker/ $ hosts key.json public-key.json $ ./docker-machine create -d virtualbox dev INFO[0000] Downloading boot2docker... INFO[0025] Creating SSH key... INFO[0025] Creating VirtualBox VM... INFO[0030] Starting VirtualBox VM... INFO[0031] Waiting for VM to start... INFO[0061] "dev" has been created and is now the active machine. To point Do
  4. 19 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ export DOCKER_HOST=$(docker-machine url) DOCKER_AUTH=identity $ echo $DOCKER_HOST tcp://192.168.99.102:2376 $ docker-machine ls NAME ACTIVE DRIVER STATE URL dev * virtualbox Running tcp://192.168.99.102:2376 $ docker ps The authenticity of host "192.168.99.102:2376" cant be established. Remote key ID OYJA:JR5T:7L3Q:TYAV:HVFM:AYI4:LK2N:UGXT:ACHI:DALZ:SFEN:SY6C Are you sure you want to continue connecting (yes/no)? yes CONTAINER ID IMAGE COMMAND CREATED STATUS POR $ docker run --rm busybox echo hello machine Unable to find image 'busybox:latest' locally busybox:latest: The image you are pulling has been verified 511136ea3c5a: Pull complete df7546f9f060: Pull complete ea13149945cb: Pull complete 4986bf8c1536: Pull complete Status: Downloaded newer image for busybox:latest hello machine
  5. 21 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ docker-machine ssh dev ## . ## ## ## == ## ## ## ## === /""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\______/ _ _ ____ _ _ | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| boot2docker: 1.2.0 master : 8a06c1f - Fri Nov 28 17:03:52 UTC 2014 docker@boot2docker:~$ docker version Client version: 1.3.1-dev Client API version: 1.16 Go version (client): go1.3.3 Git commit (client): 831d09f OS/Arch (client): linux/amd64 Server version: 1.3.1-dev Server API version: 1.16 Go version (server): go1.3.3 Git commit (server): 831d09f docker@boot2docker:~$
  6. 22 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ URL=https://github.com/boot2docker/boot2docker/releases/download/v1.4.1 $ docker-machine create -d virtualbox \ --virtualbox-boot2docker-url=${URL}/boot2docker.iso \ dev2 # hanging...
  7. 25 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ docker-machine Usage: machine [OPTIONS] COMMAND [arg...] Create and manage machines running Docker. Options: -D, --debug=false Enable debug mode -v, --version=false Print version information and quit Commands: active Get or set the active machine create Create a machine inspect Inspect information about a machine ip Get the IP address of a machine kill Kill a machine ls List machines restart Restart a machine rm Remove a machine ssh Log into or run a command on a machine with SSH start Start a machine stop Stop a machine upgrade Upgrade a machine to the latest version of Docker url Get the URL of a machine Run machine `COMMAND --help` for more information on a command.
  8. 26 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    rm -f ~/.docker/hosts/<machine name> $ docker-machine restart dev2 $ docker ps FATA[0000] TLS Handshake error: remote error: bad certificate
  9. 31 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ apt-get install -y golang $ export GOPATH=~/gocode $ go get -u github.com/docker/swarm
  10. 32 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ swarm NAME: swarm - docker clustering USAGE: swarm [global options] command [command options] [arguments...] VERSION: 0.0.1 COMMANDS: create, c create a cluster list, l list nodes in a cluster manage, m manage a docker cluster join, j join a docker cluster help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --debug debug mode [$DEBUG] --help, -h show help --version, -v print the version DOCKER_OPTS="-H 0.0.0.0:2375"
  11. 33 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    echo "192.168.33.89:2375" >>swarm.nodes echo "192.168.33.90:2375" >>swarm.nodes swarm manage --discovery file://swarm.nodes -H=192.168.33.1:4375
  12. 34 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ docker -H 192.168.33.1:4375 info Containers: 6 Nodes: 2 dockerhost1: http://192.168.33.89:2375 dockerhost2: http://192.168.33.90:2375 $ DOCKER_HOST=192.168.33.1:4375 $ docker ps CONTAINER ID IMAGE COMMAND CREATED \ STATUS PORTS NAMES 9c79ad1c4958 nginx:latest "nginx -g 'daemon of 3 hours ago \ Up 3 hours 443/tcp, 192.168.33.90:8080->80/tcp \ dockerhost2/multiple-machine_nginx_1421067200 b791d3e7bcc9 tomcat:8.0 "catalina.sh run" 8 hours ago \ Up 8 hours 192.168.33.89:8081->8080/tcp \ dockerhost1/multiple-machine_tomcat1_1421047290 be35e34173c2 tomcat:8.0 "catalina.sh run" 28 hours ago \ Up 28 hours 192.168.33.89:8080->8080/tcp \ dockerhost1/multiple-machine_tomcat_1420977182 ...
  13. 36 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ CLUSTER_ID=`swarm create` ## At every host... $ swarm join --discovery token://${CLUSTER_ID} --addr=<node-ip>:2375 ## single swarm master $ swarm manage --discovery token://${CLUSTER_ID} -H=<swarm_ip:swarm_port> ## docker clients connect swarm master $ docker -H <swarm_ip:swarm_port> info ... ## At every host... $ swarm join --discovery etcd://<etcd_ip>/<path> --addr=<node-ip>:2375 ## single swarm master $ swarm manage --discovery etcd://<etcd_ip>/<path> -H=<swarm_ip:swarm_port> ## docker clients connect swarm master docker -H <swarm_ip:swarm_port> info ...
  14. 37 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    docker run -m 1g ... docker run -c 1 ... docker run -p 80:80 ...
  15. 38 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ docker run -c 1 -p 9082:8080 -d tomcat:8.0 35d50a29ed0fde780c0826ef16ff24d2582609f877ee092c780d9aeb6f27fc75 $ docker ps CONTAINER ID IMAGE COMMAND CREATED\ STATUS PORTS NAMES 35d50a29ed0f tomcat:8.0 "catalina.sh run" 16 minutes ago\ Up Less than a second 192.168.33.89:9082->8080/tcp \ dockerhost1/insane_brattain 9c79ad1c4958 nginx:latest "nginx -g 'daemon of 5 hours ago\ Up 5 hours 443/tcp, 192.168.33.90:8080->80/tcp \ dockerhost2/multiple-machine_nginx_1421067200 ... $ docker run -c 1 -p 9083:8080 -d tomcat:8.0 f5bc6a274e82426df98eaca5e88fb01f43e03455dfebdb9ee4a3b00a7eab202e $ docker ps CONTAINER ID IMAGE COMMAND CREATED\ STATUS PORTS NAMES f5bc6a274e82 tomcat:8.0 "catalina.sh run" 16 minutes ago\ Up Less than a second 192.168.33.90:9083->8080/tcp \ dockerhost2/stupefied_albattani 35d50a29ed0f tomcat:8.0 "catalina.sh run" 17 minutes ago\ Up Less than a second 192.168.33.89:9082->8080/tcp \ dockerhost1/insane_brattain 9c79ad1c4958 nginx:latest "nginx -g 'daemon of 5 hours ago\ Up 5 hours 443/tcp, 192.168.33.90:8080->80/tcp \ dockerhost2/multiple-machine_nginx_1421067200 ...
  16. 40 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    lsb_release -a DOCKER_OPTS="--label region=de-frankfurt --label storage=ssd-vdi --label docker -d --label distributor=ubuntu docker run -e "constraint:operatingsystem=fedora" ... docker run -e "constraint:storagedriver=aufs" docker run -e "constraint:region=de-frankfurt"
  17. 46 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    shipyardrethinkdbdata: image: shipyard/rethinkdb entrypoint: /bin/bash command: -l rethinkdb: image: shipyard/rethinkdb expose: - "8080" - "28015" - "29015" volumes_from: - shipyardrethinkdbdata shipyard: image: shipyard/shipyard ports: - "5080:8080" links: - rethinkdb:rethinkdb
  18. 48 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ open http://192.168.33.89:5080 $ docker -H 192.168.33.89:2375 run --rm -it shipyard/shipyard-cli admin/shipyard
  19. 52 / 61 © 2015 <[email protected]>, @PRossbach, Docker Meetup Frankfurt

    $ docker run -d -p 8000:80 rossbachp/docker-orchestration:mfrankfurt-2015 $ open http://<docker host>:8000/docker-orchestration