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

CONTAINER ORCHESTRATION WITH THE DOCKER ECOSYSTEM

CONTAINER ORCHESTRATION WITH THE DOCKER ECOSYSTEM

**Docker orchestration talk**

Here you can find my docker slide container decks from my docker orchestration talks:

- [WJAX Munich 2015 - CONTAINER ORCHESTRATION WITH THE DOCKER ECOSYSTEM][12].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:wjax-2015`
- [EnterJS Darmstadt 2015 - Docker ORCHESTRATION for JavaScript ][10].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:enterjs-2015`
- pdf [Docker Orchestration][11] is now avaiable!
- [DevOpsCon Berlin 2015 - CONTAINER ORCHESTRATION WITH THE DOCKER ECOSYSTEM ][8].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:devopscon-2015`
- pdf [Docker Orchestration][9] is now avaiable!
- [JAX Finance London - CONTAINER ORCHESTRATION WITH THE DOCKER ECOSYSTEM ][6].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:jaxfinance-2015`
- pdf [Docker Orchestration][7] is now avaiable!
- [Microservice Meetup Berlin - Docker Orchestration ][3].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:mberlin201502`
- pdf [Docker Orchestration][4] is now avaiable!
- [Docker Meetup Frankfurt - Docker Orchestration ][1].
- open slidefire presentation container with `docker run -d -p 8000:80 rossbachp/docker-orchestration:mfrankfurt-2015`
- pdf [Docker Orchestration][2] is now avaiable!

Open slidefire presentation container with your browser `http :8000/docker-orchestration`

Feedback welcome

[Peter Rossbach][5]

[1]: http://www.meetup.com/Docker-Frankfurt/events/219160756/
[2]: https://speakerdeck.com/rossbachp/docker-meetup-frankfurt-2015-docker-orchestration
[3]: http://www.meetup.com/Microservices-Meetup-Berlin/events/219979690/
[4]: https://speakerdeck.com/rossbachp/microservice-meetup-berlin-2015-docker-orchestration
[5]: http://twitter.com/PRossbach
[6]: http://jax-finance.com/2015/session/container-orchestration-docker-ecosystem/
[7]: https://speakerdeck.com/rossbachp/container-orchestration-with-the-docker-ecosystem
[8]: http://devopsconference.de/2015/de/sessions/docker-container-orchestrierung-leicht-gemacht
[9]: https://speakerdeck.com/rossbachp/docker-container-orchestration-devopscon-2015
[10]: http://www.enterjs.de/abstracts#docker
[11]: https://speakerdeck.com/rossbachp/docker-orchestration-for-javascript
[12]: https://jax.de/wjax2015/sessions/infrastruktur-fuer-mircoservices-docker-orchestration

Peter Rossbach

November 05, 2015
Tweet

More Decks by Peter Rossbach

Other Decks in Programming

Transcript

  1. 21 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ URL=https://github.com/docker/machine/releases/download $ curl -L $URL/v0.5.0/docker-machine_darwin-amd64.zip >machine.zip $ unzip machine.zip $ rm machine.zip $ sudo mv -f docker-machine_* /usr/local/bin $ sudo chmod +x /usr/local/docker-machine_*
  2. 22 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ git clone https://github.com/docker/machine.git $ cd machine # setup a docker host (with older version or use old boot2docker) $ script/build -osarch="darwin/amd64" $ cp docker-machine_* ~/bin/ $ cd ~/bin $ chmod +x docker-machine_*
  3. 23 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ cd ~/bin $ docker-machine ls INFO[0000] Creating CA: /Users/peter/.docker/machine/certs/ca.pem INFO[0001] Creating client certificate: /Users/peter/.docker/machine/certs/c NAME ACTIVE DRIVER STATE URL $ ls -a .docker/machine/certs ca-key.pem ca.pem cert.pem key.pem server-key.pem server.pem
  4. 24 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ time docker-machine create -d virtualbox dev1 INFO[0000] Downloading boot2docker.iso to /Users/peter/.docker/images/boot2d INFO[0019] Creating SSH key... INFO[0020] Creating VirtualBox VM... INFO[0027] Starting VirtualBox VM... INFO[0027] Waiting for VM to start... INFO[0061] "dev" has been created and is now the active machine INFO[0061] To point your Docker client at it, run this in your shell: eval real 1m1.937s user 0m6.904s sys 0m6.231s
  5. 25 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ time docker-machine create -d virtualbox dev2 INFO[0000] Creating SSH key... INFO[0000] Creating VirtualBox VM... INFO[0008] Starting VirtualBox VM... INFO[0008] Waiting for VM to start... INFO[0042] "dev2" has been created and is now the active machine. INFO[0042] To point your Docker client at it, run this in your shell: eval real 0m42.850s user 0m6.031s sys 0m5.960s
  6. 26 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ docker-machine ls NAME ACTIVE DRIVER STATE URL dev1 virtualbox Running tcp://192.168.99.100:2376 dev2 * virtualbox Running tcp://192.168.99.101:2376 $ docker-machine config dev2 --tlsverify --tlscacert="/Users/peter/.docker/machine/machines/dev2/ca.pem" --tlscert="/Users/peter/.docker/m $ docker $(docker-machine config dev1) ps $ docker $(docker-machine config dev2) run \ --rm busybox /bin/sh -c "echo hello machine $(hostname)" 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 117ade53e1d6 $ docker $(docker-machine config dev2) ps -a REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE busybox latest 4986bf8c1536 5 weeks ago 2.433 MB
  7. 28 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ DOCKER_VERSION=1.9.0-rc4 $ ISO_URL=https://github.com/tianon/boot2docker-legacy/releases/download $ docker-machine create -d virtualbox \ --virtualbox-boot2docker-url \ $ISO_URL/v$DOCKER_VERSION/boot2docker.iso \ dev3 $ docker-machine ssh dev3 ## . ## ## ## == ## ## ## ## ## === /"""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\_______/ _ _ ____ _ _ | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| WARNING: this is a test.docker.com build, not a release. Boot2Docker version 1.9.0-rc3, build master : 9f3803e - Wed Oct 28 16:32:29 UTC 2015 Docker version 1.9.0-rc3, build 2100b94
  8. 35 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ docker pull swarm:1.0.0 $ docker run --rm swarm:1.0.0 create <SWARM_TOKEN> # Master $ docker run -d -p 3376:2376 swarm:1.0.0 manage \ <TLS CONFIG> token://<SWARM_TOKEN> # Agent $ docker run -d swarm:1.0.0 join \ --addr=<node_ip:2376> token://<cluster_id>
  9. 39 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    docker run -m 1g ... docker run -c 1 ... docker run -p 80:80 ...
  10. 40 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ 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 ...
  11. 41 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    lsb_release -a DOCKER_OPTS="--label region=de-berlin \ --label storage=ssd-vdi \ --label role=loadbalancer" docker -d ${DOCKER_OPTS} --label stage=prod docker run -e "constraint:operatingsystem==fedora" ... docker run -e "constraint:storagedriver==aufs" ... docker run -e "constraint:region==de-berlin" ... docker run -e "constraint:node!=dev2" ... constraint:node==/swarm-node-00[12]/ constraint:node!=app* constraint:node==/(?i)node1/
  12. 42 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    docker run -d -p 80:80 --name front nginx docker run -e "affinity:container==front" logger docker run -e "affinity:image==redis" redis docker run -d -p 80:80 --label com.example.type=frontend nginx docker run -d -e affinity:com.example.type==frontend logger docker run -d --name redis1 -e affinity:image==~redis redis docker run -d --name redis2 -e constraint:region==~us* redis docker run -d --name redis5 -e affinity:container!=~redis* redis
  13. 43 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    --volumes-from=dependency --link=dependency:alias network stack: --net=container:dependency
  14. 44 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    DOT=XYZ docker pull swarm:1.0.0-rc2 SWARM_TOKEN=$(docker run --rm swarm:1.0.0-rc2 create) echo $SWARM_TOKEN >token.txt docker-machine create \ --driver digitalocean \ --digitalocean-region fra1 \ --digitalocean-size 1gb \ --digitalocean-access-token $DOT \ --digitalocean-private-networking \ --engine-install-url "https://test.docker.com" \ --swarm \ --swarm-image swarm:1.0.0-rc2 \ --swarm-master \ --swarm-discovery token://$SWARM_TOKEN \ --engine-label zone=prod \ --engine-label swarm=master \ swarm-master
  15. 45 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    docker-machine create \ --driver digitalocean \ --digitalocean-region fra1 \ --digitalocean-size 1gb \ --digitalocean-access-token $DOT \ --digitalocean-private-networking \ --engine-install-url "https://test.docker.com" \ --swarm \ --swarm-image swarm:1.0.0-rc2 \ --swarm-discovery token://$SWARM_TOKEN \ --engine-label zone=prod \ --engine-label swarm=node \ swarm-node-001
  16. 50 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    tomcat: image: infrabricks/tomcat:8 ports: - "8080" environment: - constraint:zone==dev - constraint:swarm==node SERVICE_8080_NAME: status-http SERVICE_REGION: bee42.1 SERVICE_8080_CHECK_HTTP: /status/ping.jsp SERVICE_8080_CHECK_INTERVAL: 30s
  17. 51 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    status: image: infrabricks/status tomcatgreen: extends: file: common.yml service: tomcat volumes_from: - status_20151005-1 environment: SERVICE_TAGS: tomcat,green
  18. 52 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    status: image: infrabricks/status tomcatblue: extends: file: common.yml service: tomcat volumes_from: - status_20151005-2 environment: SERVICE_TAGS: tomcat,blue
  19. 53 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    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
  20. 55 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ eval $(docker-machine env dev2) $ docker-compose up -d $ open http://$(docker-machine ip dev2):5080 $ docker run --rm -it shipyard/shipyard-cli admin/shipyard
  21. 61 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ docker -d --kv-store=consul:<conul agent ip>:8500 \ --label=com.docker.network.driver.overlay.bind_interface=eth0 $ docker -d --kv-store=consul:<conul agent ip>:8500 \ --label=com.docker.network.driver.overlay.bind_interface=eth0 \ --label=com.docker.network.driver.overlay.neighbor_ip=<host-1-ip-address>
  22. 62 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

    $ docker network create -d overlay prod $ docker network ls $ docker network info prod $ docker run -itd --publish-service db1.prod.overlay -p 8000:8000 ubuntu $ docker network ls $ docker network inspect prod $ docker run -itd --publish-service db2.prod.overlay -p 8000:8000 ubuntu $ docker network inspect prod ...
  23. 86 / 94 © 2015 <[email protected]>, @PRossbach, WJAX Munich 2015

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