SlideShare a Scribd company logo
docker-machine
docker-composer
docker-swarm“Author: Junya Nakazato
© CA Advance, Inc. All Rights Reserved 1
NewDockertoolsDocker Marchine, Docker Compose, Docker Swarmをピックアップ!
© CA Advance, Inc. All Rights Reserved 2
docker-machineって?
公式docker 自動環境構築
EC2,digitalocean,Azure,virtualbox対応
© CA Advance, Inc. All Rights Reserved 3
digitaloceanに
デプロイするには…
© CA Advance, Inc. All Rights Reserved 4
howto :
digitaloceanにデプロイ
# 適宜取得
% export DIGITALOCEAN_TOKEN=TEKITOUNATOKEN
# サーバー構築!
% docker-machine create -d digitalocean 
--digitalocean-access-token=$DIGITALOCEAN_TOKEN 
--digitalocean-region "sgp1" 
--digitalocean-size "1gb" my-awesome-app
© CA Advance, Inc. All Rights Reserved 5
howto :
digitaloceanにデプロイ
docker-machine list!!!1
# 管理が楽になるね!
% docker-machine ls
NAME DRIVER STATE URL
linux virtualbox Stopped
linux-dev digitalocean Running tcp://128.199.164.1:2376
© CA Advance, Inc. All Rights Reserved 6
Local→VPS!!1vps-managerと(^_^)/~
# rails実験場が欲しければこれで
% docker -it $(docker-machine config myapp) run rails bash
% docker -it $(docker-machine config myapp) run rails c
# 終わったら削除
% docker-machine rm myapp
© CA Advance, Inc. All Rights Reserved 7
docker-composeって?
公式docker-tool 複数コンテナ同時実行
yaml形式で構成定義
マイクロサービスの実装形
fig買収->docker-compose
© CA Advance, Inc. All Rights Reserved 8
HOWTO : compose? 
開発フロー
» 1. docker-compose.ymlに構成を記載
» 2. %docker-compose build && docker-compose run
» 3. あとはサービスを使うだけ!
© CA Advance, Inc. All Rights Reserved 9
docker-compose.yml(1)
mysql:
image: mysql:5.7.7
environment:
MYSQL_ROOT_PASSWORD: 'melody'
ports:
- '3306:3306'
volumes_from:
- datastore
nginx:
build: containers/nginx
ports:
- '80:80'
volumes_from:
- datastore
links:
- rails
© CA Advance, Inc. All Rights Reserved 10
docker-compose.yml(2)
datastore:
build: containers/datastore
rails:
build: .
ports:
- '3000:3000'
environment:
RAILS_ENV: production
DATABASE_URL: mysql2://root:melody@mysql:3306
MYSQL_ROOT_PASSWORD: 'melody'
volumes_from:
- datastore
links:
- mysql
© CA Advance, Inc. All Rights Reserved 11
LodgeQiitaClone
docker-compose対応
% git clone http://github.com/j138/lodge-docker
© CA Advance, Inc. All Rights Reserved 12
docker-swarm!?
Dockerホストをクラスタ化
Docker-machineとの親和性あり
各種Dockerツールとの連携も今後予定
© CA Advance, Inc. All Rights Reserved 13
howto: docker-swarm1. トークン生成
% docker-swarm create
7988b7fb66edd9573eac62eefb87007f
% export SWARM_TOKEN=7988b7fb66edd9573eac62eefb87007f
© CA Advance, Inc. All Rights Reserved 14
howto: docker-swarm2. docker-machineでマシン構築
% docker-machine create -d digitalocean 
--digitalocean-access-token=$DIGITALOCEAN_TOKEN --swarm --swarm-master 
--swarm-discovery token://$SWARM_TOKEN swarm-master
% docker-machine create -d digitalocean 
--digitalocean-access-token=$DIGITALOCEAN_TOKEN --swarm 
--swarm-discovery token://$SWARM_TOKEN node01
© CA Advance, Inc. All Rights Reserved 15
howto: docker-swarm3. swarm-masterへの紐付けチェック
% docker-machine ls
NAME DRIVER STATE URL SWARM
swarm-master digitalocean Running tcp://45.55.184.3:2376 swarm-master (master)
swarm-node01 digitalocean Running tcp://128.199.164.1:2376 swarm-master
swarm-node02 digitalocean Running tcp://128.199.163.254:2376 swarm-master
swarm-node03 digitalocean Running tcp://128.199.167.1:2376 swarm-master
© CA Advance, Inc. All Rights Reserved 16
howto: docker-swarm4. コンテナの起動
紐つけたホストに対して、コンテナを分散して起動してくれる!
社内だと22番ポート閉じられてて、digitaloceanで試せなかった><
IPアドレスに注目!
% docker run -d -p 80:80 dockerfile/nginx
% docker run -d -p 80:80 dockerfile/nginx
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
63abf37db4cf dockerfile/nginx:latest "nginx" 11 seconds ago Up 6 seconds 443/tcp, 10.3.0.52:80->80/tcp
d21f305376aa dockerfile/nginx:latest "nginx" 4 minutes ago Up 4 minutes 443/tcp, 10.3.0.67:80->80/tcp
© CA Advance, Inc. All Rights Reserved 17
いろいろ喋ったけど。。。
machine, compose, swarm
まだベータなので注意!
© CA Advance, Inc. All Rights Reserved 18
docker ❤
ENJOY!© CA Advance, Inc. All Rights Reserved 19

More Related Content

PDF
전 세계 팬들이 모일 수 있는 플랫폼 만들기 - 강진우 (beNX) :: AWS Community Day 2020
PDF
Spinnaker 파트 1
PDF
ECS and ECR deep dive
PDF
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
PDF
Running your Java EE 6 applications in the Cloud (FISL 12)
PDF
Deploying a Kubernetes App with Amazon EKS
PPTX
Deploying your web application with AWS ElasticBeanstalk
PDF
Using Docker For Development
전 세계 팬들이 모일 수 있는 플랫폼 만들기 - 강진우 (beNX) :: AWS Community Day 2020
Spinnaker 파트 1
ECS and ECR deep dive
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
Running your Java EE 6 applications in the Cloud (FISL 12)
Deploying a Kubernetes App with Amazon EKS
Deploying your web application with AWS ElasticBeanstalk
Using Docker For Development

What's hot (8)

PDF
London Hug 19/5 - Terraform in Production
PDF
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
PDF
Ansible Configuration Management Tool 소개 및 활용
PDF
Hashicorp @ JUST EAT - Part 2
PPTX
GlobalAzureBootCamp 2018
PDF
Azure Kubernetes Service - benefits and challenges
PPTX
Automation with Packer and TerraForm
PPTX
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
London Hug 19/5 - Terraform in Production
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
Ansible Configuration Management Tool 소개 및 활용
Hashicorp @ JUST EAT - Part 2
GlobalAzureBootCamp 2018
Azure Kubernetes Service - benefits and challenges
Automation with Packer and TerraForm
Introduction to Packer and Suitcase: A Packer-based OS Image Build System
Ad

Viewers also liked (20)

PPTX
Introduction to docker swarm
PDF
PDF
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
PDF
Docker swarm introduction
PPTX
Docker Swarm Introduction
PDF
Docker Swarm 0.2.0
PPTX
Docker-machine
PDF
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
PDF
Docker 1.12 - Swarm Mode
PDF
MTLS in a Microservices World
PDF
Multi host networking with docker
PDF
Docker 1.13 - Docker meetup février 2017
PDF
Docker Networking – Running multi-host applications
PPT
Docker Multi Host Networking, Rachit Arora, IBM
PPTX
Docker 1.5
PDF
Docker, Docker Swarm mangement tool - Gorae
PDF
Aura Framework Overview
PDF
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
PPTX
Docker Networking & Swarm Mode Introduction
PDF
Docker Architecture (v1.3)
Introduction to docker swarm
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Docker swarm introduction
Docker Swarm Introduction
Docker Swarm 0.2.0
Docker-machine
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 - Swarm Mode
MTLS in a Microservices World
Multi host networking with docker
Docker 1.13 - Docker meetup février 2017
Docker Networking – Running multi-host applications
Docker Multi Host Networking, Rachit Arora, IBM
Docker 1.5
Docker, Docker Swarm mangement tool - Gorae
Aura Framework Overview
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
Docker Networking & Swarm Mode Introduction
Docker Architecture (v1.3)
Ad

Similar to docker-machine, docker-compose, docker-swarm 覚書 (20)

PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
PDF
Dockerを用いたマイクロサービスについて
PDF
CoreOSによるDockerコンテナのクラスタリング
PDF
Portainer.io Intro | Into The Box 2018
PDF
Docker Cheatsheet_02
PDF
廣宣學堂: 容器進階實務 - Docker進深研究班
PDF
Docker 進階實務班
PDF
Higher order infrastructure: from Docker basics to cluster management - Nicol...
PDF
Paolucci voxxed-days-berlin-2016-age-of-orchestration
PDF
Distributed application usecase on docker
PPTX
Docker Platform and Ecosystem Nov 2015
PPTX
Docker for the new Era: Introducing Docker,its components and tools
PDF
Docker Introduction
PPTX
Intro docker and demo monitor on docker
PPTX
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
PDF
Drone CI/CD 自動化測試及部署
PPTX
Docker SF Meetup January 2016
PPTX
Docker Container As A Service - Mix-IT 2016
PDF
Swarm: Native Docker Clustering
PDF
Introduction to Docker and Monitoring with InfluxData
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Dockerを用いたマイクロサービスについて
CoreOSによるDockerコンテナのクラスタリング
Portainer.io Intro | Into The Box 2018
Docker Cheatsheet_02
廣宣學堂: 容器進階實務 - Docker進深研究班
Docker 進階實務班
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Paolucci voxxed-days-berlin-2016-age-of-orchestration
Distributed application usecase on docker
Docker Platform and Ecosystem Nov 2015
Docker for the new Era: Introducing Docker,its components and tools
Docker Introduction
Intro docker and demo monitor on docker
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Drone CI/CD 自動化測試及部署
Docker SF Meetup January 2016
Docker Container As A Service - Mix-IT 2016
Swarm: Native Docker Clustering
Introduction to Docker and Monitoring with InfluxData

More from じゅん なかざ (6)

PDF
Amazon ECS事始め
PDF
LESS使ってますか?
PDF
monit入れてみた
PDF
既存システムへの新技術活用法 ~fluntd/MongoDB~
PDF
PHP開発者のためのNoSQL入門
PDF
JMeter によるパフォーマンステスト指南
Amazon ECS事始め
LESS使ってますか?
monit入れてみた
既存システムへの新技術活用法 ~fluntd/MongoDB~
PHP開発者のためのNoSQL入門
JMeter によるパフォーマンステスト指南

Recently uploaded (20)

PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Geodesy 1.pptx...............................................
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Project quality management in manufacturing
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
web development for engineering and engineering
PDF
Digital Logic Computer Design lecture notes
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
Foundation to blockchain - A guide to Blockchain Tech
Geodesy 1.pptx...............................................
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Project quality management in manufacturing
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
web development for engineering and engineering
Digital Logic Computer Design lecture notes
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
additive manufacturing of ss316l using mig welding
bas. eng. economics group 4 presentation 1.pptx
Construction Project Organization Group 2.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CH1 Production IntroductoryConcepts.pptx
Internet of Things (IOT) - A guide to understanding

docker-machine, docker-compose, docker-swarm 覚書