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 Swarm
Network
Spooky 

Outline
‣ Introduce
‣ Linking containers together
‣ Linking Docker Engine
‣ multi-host networking
‣ Docker Swarm on multip...
Docker Orchestration
Linking Containers Together
Linking Containers
docker compose

links
docker compose

external_links
docker command

links
1 on 1
server database
Links
browser
test

case
JCConf 2015 workshop: 透過 docker 進⾏ e2e test,以 Gradle 及 Geb 為例

http://blog...
main:
container_name: jcconf_main
image: trunk/groovy_gradle
command: "/bin/bash -l -c 'gradle remoteFirefoxTest'"
links:
...
external_links
server
database
server
N on 1
test
preview
https://github.com/TrunkWorkshop/sailsSample
mysql:
container_name: mysql
image: dgraziotin/mysql
ports:
- "3306:3306"
environment:
MYSQL_ADMIN_PASS: "root"
MYSQL_USER...
Linking Docker Engine
Docker Swarm
cloud

Docker Swarm
Docker Swarm 

with Network

local

Docker Swarm
https://github.com/TrunkWorkshop/docker-swarm-sample/tree/master/local


Swarm
Master
Swarm
Node
Swarm
Node
Docker
Machine...
docker info
Overlay

Network
key-store
consul
Swarm
Master
Swarm
Node
Docker
Machine Container Communication
Docker Engine Control
Doc...
‣ Port allow
‣ Docker Engine port (e.g TCP 2375)
‣ VXLAN: UDP 4789
‣ Serf: TCP + UDP 7946
‣ Key-value store ( e.g for Cons...
Digital Ocean
‣ setup your token
‣ export DIGITALOCEAN_ACCESS_TOKEN=12345
https://github.com/TrunkWorkshop/docker-swarm-sa...
Google Cloud Platform
‣ gcloud auth login https://cloud.google.com/sdk/
‣ create google-project
‣ export GOOGLE_PROJECT='p...
Prepare Muti-Host 

Docker Environment
key-store
consul
Docker
Machine
create-machine-keystore:
docker-machine create 
--driver digitalocean 
--digitalocean-imag...
key-store
consul
create-machine-swarm-master:
docker-machine create 
--driver digitalocean 
--digitalocean-image ubuntu-15...
key-store
consul
create-machine-swarm-node:
docker-machine create 
--driver digitalocean 
--digitalocean-image ubuntu-15-1...
Docker Machine ls
Docker Info
Create Overlay Network
create-network-overlay:
docker network create --driver overlay cloud-overlay
Overlay

Network
key-s...
Docker Network ls
digitalocean-master
google-note
Run Docker Containers

With

Multi-Host Docker Environment
Orchestration
Docker Compose

Manual Network
Docker Compose

Auto Network
Docker

Command
Docker Commandrun-sample-server:
docker run -itd 
--name=web 
--net=cloud-overlay 
--env="constraint:node==master" 
nginx
...
compose_web:
container_name: 'compose_web'
image: bfirsh/compose-mongodb-demo
environment:
- "MONGO_HOST=compose_mongo"
- ...
compose_web:
container_name: 'compose_web'
image: bfirsh/compose-mongodb-demo
environment:
- "MONGO_HOST=compose_mongo"
- ...
cat /etc/hosts
docker network inspect
https://github.com/TrunkWorkshop/docker-swarm-sample
make clean-machine
make create-machine-keystore
eval $(docker-machine...
High availability in Docker Swarm

https://docs.docker.com/swarm/multi-manager-setup/
Docker-swarm Docker

http://blog.tru...
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
Practical Design Patterns in Docker Networking
Next
Upcoming SlideShare
Practical Design Patterns in Docker Networking
Next
Download to read offline and view in fullscreen.

Share

Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境

Download to read offline

最新的 Docker 1.9.0 在 11 月份正式推出,此講題將介紹最新的 Network 的特性,介紹如何透過 Docker Machine 建置多台 Docker Engine,使用 Docker swarm 整合跨網路多主機叢集環境,最後在由 Docker Compose 來讓環境設置清楚易懂,達到三位一體夢幻的組合!

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境

  1. 1. Docker Swarm Network Spooky 

  2. 2. Outline ‣ Introduce ‣ Linking containers together ‣ Linking Docker Engine ‣ multi-host networking ‣ Docker Swarm on multiple VM ‣ Docker Swarm on multiple cloud instance
  3. 3. Docker Orchestration
  4. 4. Linking Containers Together
  5. 5. Linking Containers docker compose
 links docker compose
 external_links docker command
 links
  6. 6. 1 on 1 server database Links browser test
 case JCConf 2015 workshop: 透過 docker 進⾏ e2e test,以 Gradle 及 Geb 為例
 http://blog.trunk-studio.com/jcconf2015/
  7. 7. main: container_name: jcconf_main image: trunk/groovy_gradle command: "/bin/bash -l -c 'gradle remoteFirefoxTest'" links: - client volumes: - ./:/jcconf_main working_dir: /jcconf_main client: container_name: jcconf_client image: vvoyer/docker-selenium-firefox-chrome ports: - "4444:4444" - "5999:5999" docker-compose up -d Links
  8. 8. external_links server database server N on 1 test preview https://github.com/TrunkWorkshop/sailsSample
  9. 9. mysql: container_name: mysql image: dgraziotin/mysql ports: - "3306:3306" environment: MYSQL_ADMIN_PASS: "root" MYSQL_USER_NAME: "nodejsSample" MYSQL_USER_DB: "nodejsSample" MYSQL_USER_PASS: "nodejsSample" CREATE_MYSQL_BASIC_USER_AND_DB: "true" volumes: - ../database:/var/lib/mysql/ restart: always web: container_name: sailsSample image: trunk/sails_env command: "/bin/bash -l -c 'npm start'" ports: - "1337:1337" working_dir: /sailsSample volumes: - ./:/sailsSample external_links: - mysql restart: always docker-compose up -d mysql docker-compose up -d web external_links
  10. 10. Linking Docker Engine
  11. 11. Docker Swarm cloud
 Docker Swarm Docker Swarm 
 with Network
 local
 Docker Swarm
  12. 12. https://github.com/TrunkWorkshop/docker-swarm-sample/tree/master/local 
 Swarm Master Swarm Node Swarm Node Docker Machine Local & Cloud Docker Swarm
  13. 13. docker info
  14. 14. Overlay
 Network key-store consul Swarm Master Swarm Node Docker Machine Container Communication Docker Engine Control Docker Engine Register Cloud Docker Swarm Digital Ocean My laptop Digital Ocean Google
  15. 15. ‣ Port allow ‣ Docker Engine port (e.g TCP 2375) ‣ VXLAN: UDP 4789 ‣ Serf: TCP + UDP 7946 ‣ Key-value store ( e.g for Consul TCP 8500) ‣ Support Docker Network feature ‣ kernel 3.18+
  16. 16. Digital Ocean ‣ setup your token ‣ export DIGITALOCEAN_ACCESS_TOKEN=12345 https://github.com/TrunkWorkshop/docker-swarm-sample/tree/master/digitalocean
  17. 17. Google Cloud Platform ‣ gcloud auth login https://cloud.google.com/sdk/ ‣ create google-project ‣ export GOOGLE_PROJECT='project name' ‣ activate Compute Engine API ‣ setup firewall-rules ‣ gcloud compute firewall-rules update default-swarm --allow tcp:2376 tcp:2375 tcp:3376 tcp:8500 UDP:4789 TCP:7946 UDP:7946 --source-range 0.0.0.0/0 ‣ gcloud compute firewall-rules create default-demo --allow tcp:5000 tcp:27017 tcp:80 --source-range 0.0.0.0/0 https://github.com/TrunkWorkshop/docker-swarm-sample/tree/master/google
  18. 18. Prepare Muti-Host 
 Docker Environment
  19. 19. key-store consul Docker Machine create-machine-keystore: docker-machine create --driver digitalocean --digitalocean-image ubuntu-15-10-x64 digitalocean-keystore run-consul: docker run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap create keystore Digital Ocean My laptop
  20. 20. key-store consul create-machine-swarm-master: docker-machine create --driver digitalocean --digitalocean-image ubuntu-15-10-x64 --swarm --swarm-image="swarm" --swarm-master --swarm-discovery="consul://$(DOCKER_IP_KEYSTORE):8500" --engine-opt="cluster-store=consul://$(DOCKER_IP_KEYSTORE):8500" --engine-opt="cluster-advertise=eth0:2376" digitalocean-master Create Swarm Master Swarm Master Docker Machine export DOCKER_IP_KEYSTORE=$(docker-machine ip digitalocean-keystore) Digital Ocean My laptop Digital Ocean
  21. 21. key-store consul create-machine-swarm-node: docker-machine create --driver digitalocean --digitalocean-image ubuntu-15-10-x64 --swarm --swarm-image="swarm" --swarm-discovery="consul://$(DOCKER_IP_KEYSTORE):8500" --engine-opt="cluster-store=consul://$(DOCKER_IP_KEYSTORE):8500" --engine-opt="cluster-advertise=eth0:2376" digitalocean-node Create Swarm Node Swarm Master Docker Machine export DOCKER_IP_KEYSTORE=$(docker-machine ip digitalocean-keystore) Swarm Node Digital Ocean My laptop Digital Ocean Google
  22. 22. Docker Machine ls
  23. 23. Docker Info
  24. 24. Create Overlay Network create-network-overlay: docker network create --driver overlay cloud-overlay Overlay
 Network key-store consul Swarm Master Swarm Node Docker Machine Digital Ocean My laptop Digital Ocean Google
  25. 25. Docker Network ls digitalocean-master google-note
  26. 26. Run Docker Containers
 With
 Multi-Host Docker Environment
  27. 27. Orchestration Docker Compose
 Manual Network Docker Compose
 Auto Network Docker
 Command
  28. 28. Docker Commandrun-sample-server: docker run -itd --name=web --net=cloud-overlay --env="constraint:node==master" nginx run-sample-client: docker run -it --rm --net=cloud-overlay --env="constraint:node==node" busybox wget -O- http://web Overlay
 Network key-store consul Swarm Master Swarm Node Docker Machine api server client server
  29. 29. compose_web: container_name: 'compose_web' image: bfirsh/compose-mongodb-demo environment: - "MONGO_HOST=compose_mongo" - "constraint:node==google-node" net: overlay ports: - "80:5000" Docker Compose Manual Network compose_mongo: container_name: 'compose_mongo' image: mongo environment: - "constraint:node==master" net: overlay Overlay
 Networkkey-store consul Swarm Master Swarm Node Docker Machine server database docker-compose up -d
  30. 30. compose_web: container_name: 'compose_web' image: bfirsh/compose-mongodb-demo environment: - "MONGO_HOST=compose_mongo" - "constraint:node==google-node" ports: - "80:5000" Docker Compose Auto Network compose_mongo: container_name: 'compose_mongo' image: mongo environment: - "constraint:node==master" Overlay
 Networkkey-store consul Swarm Master Swarm Node Docker Machine server database docker-compose --x-networking --x-network-driver overlay up -d
  31. 31. cat /etc/hosts
  32. 32. docker network inspect
  33. 33. https://github.com/TrunkWorkshop/docker-swarm-sample make clean-machine make create-machine-keystore eval $(docker-machine env digitalocean-keystore) export DOCKER_IP_KEYSTORE=$(docker-machine ip digitalocean-keystore) make run-consul make create-machine-swarm-master make create-machine-swarm-node eval $(docker-machine env --swarm digitalocean-master) make create-network-overlay make run-sample-server make run-sample-clients make run-by-compose
  34. 34. High availability in Docker Swarm
 https://docs.docker.com/swarm/multi-manager-setup/ Docker-swarm Docker
 http://blog.trunk-studio.com/docker-swarm-network/ DockerCon EU 2015 Hands-On Labs https://github.com/docker/dceu_tutorials
  • LeonLin37

    Mar. 4, 2018
  • jmchung1

    May. 22, 2017
  • LeiYang12

    Jan. 24, 2017
  • zuoqi

    Nov. 3, 2016
  • danielliu7528

    Sep. 13, 2016
  • YenHaoHuang1

    Aug. 17, 2016
  • zanhsieh

    Aug. 6, 2016
  • NikanWang

    Jul. 23, 2016
  • SeaDream74

    Jul. 7, 2016
  • linekin

    Jul. 4, 2016
  • chiahsichang

    Jan. 26, 2016
  • przemyslawciesielski

    Jan. 23, 2016
  • Buf01

    Jan. 18, 2016
  • TillTsai

    Dec. 23, 2015
  • macchiang

    Dec. 21, 2015
  • salomarx

    Dec. 18, 2015
  • baibaitung

    Dec. 15, 2015
  • alanmoment

    Dec. 13, 2015
  • bbhenry

    Dec. 13, 2015
  • jazzwang

    Dec. 13, 2015

最新的 Docker 1.9.0 在 11 月份正式推出,此講題將介紹最新的 Network 的特性,介紹如何透過 Docker Machine 建置多台 Docker Engine,使用 Docker swarm 整合跨網路多主機叢集環境,最後在由 Docker Compose 來讓環境設置清楚易懂,達到三位一體夢幻的組合!

Views

Total views

6,493

On Slideshare

0

From embeds

0

Number of embeds

1,664

Actions

Downloads

105

Shares

0

Comments

0

Likes

23

×