SlideShare une entreprise Scribd logo
1  sur  25
1
2015. 5. 28
㈜ 오픈소스컨설팅
김호진,박현익
Using Docker and
How to orchestrate it.
2
Contents
1. Container image 관리
1.1 Docker registry
2. Docker Compose
2.1 Compose install & define the project
2.2 PHP wordpress programming
3. Docker Swarm
2.3 Build by docker file
2.4 Docker registry & start by docker-compose
4. Docker Kubernetes
3
yum install docker-registry
Create private Docker registries
Docker local registry 만들기
[root@docker187 ~]# systemctl status docker.service
[root@docker187 ~]# systemctl -l status docker-registry
[root@docker187 ~]# docker login
Username (oscinfra):
WARNING: login credentials saved in /root/.dockercfg.
Login Succeeded
https://registry.hub.docker.com/repos/ [root@docker187 ~]# netstat -ntpl | grep 5000
tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN 729/python
firewall-cmd --zone=public --list-services
firewall-cmd --zone=public --list-ports
firewall-cmd --permanent --zone=public --add-
service=https
firewall-cmd --permanent --zone=public --add-
port=5000/tcp
firewall-cmd --zone=public --add-port=5000/tcp
firewall-cmd –reload
[root@docker187 ~]# nmap localhost
PORT STATE SERVICE
5000/tcp open upnp
4
yum install docker-registry
Create private Docker registries
Root image 가지고 오기
[root@docker188 ~]# docker pull mysql:latest
latest: Pulling from docker.io/mysql
[root@docker188 ~]# docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=qwerqwer -d mysql
d10d4821e9b96f7f1f5065351f83e014f2799bf8b4febc9da6d3573d12f8aa4e
[root@docker188 ~]# docker run --name wordpress-instance --link some-mysql:mysql -p 8000:80 -d wordpress
edb109fc4ba635f77f9e506b786b3b5529f8d6b7fd6a12ab4adb53116907d02e
[root@docker188 ~]# nmap localhost
5000/tcp open upnp
8080/tcp open http-proxy
출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/
5
yum install docker-registry
Create private Docker registries
Install 후 commit작업 실시
출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/
6
yum install docker-registry
Create private Docker registries
Install 후 commit작업 실시
[root@docker188 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 11 minutes ago Up 11 minutes 0.0.0.0:8080->80/tcp wordpress-instance
d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 13 minutes ago Up 13 minutes 3306/tcp some-mysql
[root@docker188 ~]# docker commit edb109fc4ba6 osc_wordpress
9655c5be2aa9013d72dc4908d38149e9938b03f32039f1bb89fe226ee9478a11
[root@docker188 ~]# docker commit d10d4821e9b9 osc_mysql
d1341c6a3b5860cbb55d08e96e239224786e4c3767294e2d13705609a183f353
[root@docker188 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
osc_mysql latest d1341c6a3b58 About a minute ago 282.9 MB
osc_wordpress latest 9655c5be2aa9 About a minute ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 44 hours ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB
[root@docker188 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 14 minutes ago Exited (0) 36 seconds ago wordpress-instance
d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 16 minutes ago Exited (0) 34 seconds ago some-mysql
7
yum install docker-registry
Create private Docker registries
Install 후 commit작업 실시
[root@docker188 ~]# docker stop `docker ps -qa`
[root@docker188 ~]# docker run --name osc_mysql -e MYSQL_ROOT_PASSWORD='qwerqwer' -d osc_mysql
d15491be7bc85bf764f1a2bb2c2b9d7c00e76e1eae476ee572ff52bc609daa68
[root@docker188 ~]# docker run --name osc_wordpress2 --link osc_mysql:mysql -p 8090:80 -d osc_wordpress
12dceb757464a858326658a8c8d26b45d5efa7631d47c7b33ac0bcc14d8bced6
[root@docker188 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
12dceb757464 osc_wordpress:latest "/entrypoint.sh apac 11 seconds ago Up 10 seconds 0.0.0.0:8080->80/tcp osc_wordpress2
d15491be7bc8 osc_mysql:latest "/entrypoint.sh mysq About a minute ago Up About a minute 3306/tcp osc_mysql
edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 17 minutes ago Exited (0) 3 minutes ago wordpress-instance
d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 19 minutes ago Exited (0) 3 minutes ago some-mysql
8
yum install docker-registry
Create private Docker registries
Commit후 private Docker registry에 등록 후 파일 전송
[root@docker188 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB
osc_wordpress latest d590073094fd 2 hours ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB
[root@docker188 ~]# docker tag osc_mysql:latest localhost:5000/osc/osc_mysql
[root@docker188 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB
localhost:5000/osc/osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB
osc_wordpress latest d590073094fd 2 hours ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB
[root@docker188 ~]# docker push localhost:5000/osc/osc_mysql
The push refers to a repository [localhost:5000/osc/osc_mysql] (len: 1)
Sending image list
967e48b02b99: Image successfully pushed
Pushing tag for rev [967e48b02b99] on {http://localhost:5000/v1/repositories/osc/osc_mysql/tags/latest}
9
yum install docker-registry
Create private Docker registries
Commit후 private Docker registry에 등록 후 파일 전송
[root@docker188 ~]# docker tag osc_wordpress localhost:5000/osc/osc_wordpress
[root@docker188 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
localhost:5000/osc/osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB
osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB
localhost:5000/osc/osc_wordpress latest d590073094fd 3 hours ago 511.5 MB
osc_wordpress latest d590073094fd 3 hours ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB
[root@docker188 ~]# docker push localhost:5000/osc/osc_wordpress
The push refers to a repository [localhost:5000/osc/osc_wordpress] (len: 1)
Sending image list
Pushing repository localhost:5000/osc/osc_wordpress (1 tags)
d590073094fd: Image successfully pushed
Pushing tag for rev [d590073094fd] on {http://localhost:5000/v1/repositories/osc/osc_wordpress/tags/latest}
10
Docker Compose
소개
도커 복잡한 응용 프로그램을 정의하고
실행하기위한 도구입니다
멀티 컨테이너를 하나의 파일로 운용
하나의 command로 모든 doker file들 실행
11
Docker compose
Compose install & define the project
출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/
[root@docker188 ~]# curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-
compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 403 0 403 0 0 343 0 --:--:-- 0:00:01 --:--:-- 343
100 5140k 100 5140k 0 0 1031k 0 0:00:04 0:00:04 --:--:-- 1871k
[root@docker188 ~]# chmod +x /usr/local/bin/docker-compose
[root@docker188 ~]# curl https://wordpress.org/latest.tar.gz | tar -xvzf -
[root@docker188 wordpress]# cat Dockerfile
FROM orchardup/php5
ADD . /code
[root@docker188 wordpress]# cat docker-compose.yml
web:
build: .
command: php -S 0.0.0.0:8000 -t /code
ports:
- "8000:8000"
links:
- db
volumes:
- .:/code
db:
image: orchardup/mysql
environment:
MYSQL_DATABASE: wordpress
12
Docker compose
Php wordpress programming
간단 program
[root@docker01 wordpress]# cat wp-config.php
<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', "db:3306");
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY', 'test');
define('SECURE_AUTH_KEY', 'test');
define('LOGGED_IN_KEY', 'test');
define('NONCE_KEY', 'test');
define('AUTH_SALT', 'test');
define('SECURE_AUTH_SALT', 'test');
define('LOGGED_IN_SALT', 'test');
define('NONCE_SALT', 'test');
$table_prefix = 'wp_';
define('WPLANG', '');
define('WP_DEBUG', false);
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
[root@docker01 wordpress]# cat router.php
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path =
'/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['p
ath'],'/');
set_include_path(get_include_path().':'.__DIR__
);
if(file_exists($root.$path))
{
if(is_dir($root.$path) &&
substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
if(strpos($path,'.php') === false) return
false;
else {
chdir(dirname($root.$path));
require_once $root.$path;
}
}else include_once 'index.php';
13
Docker compose
Build by docker file
실행
[root@docker188 wordpress]# docker build -t
oscinfra_web .
Sending build context to Docker daemon 19.79 MB
Sending build context to Docker daemon
Step 0 : FROM orchardup/php5
Trying to pull repository docker.io/orchardup/php5 ...
7113324d9d9e: Download complete
511136ea3c5a: Download complete
e2aa6665d371: Download complete
f0ee64c4df74: Download complete
2209cbf9dcd3: Download complete
5e019ab7bf6d: Download complete
Status: Downloaded newer image for
docker.io/orchardup/php5:latest
---> 7113324d9d9e
Step 1 : ADD . /code
---> 4ea4c8b5cb7f
Removing intermediate container 5ab560447a8b
Successfully built 4ea4c8b5cb7f
[root@docker188 wordpress]# docker images
REPOSITORY TAG
IMAGE ID CREATED VIRTUAL SIZE
oscinfra_web latest
4ea4c8b5cb7f 10 seconds ago 348.9 MB
[root@docker01 wordpress]# docker-compose up
Creating wordpress_db_1...
Pulling image orchardup/mysql:latest...
Pulling repository orchardup/mysql
061b756f7e0d: Download complete
Status: Downloaded newer image for
orchardup/mysql:latest
Creating wordpress_web_1...
Building web...
Step 0 : FROM orchardup/php5
---> 7113324d9d9e
..
db_1 | 150301 14:54:42 InnoDB: highest
supported file format is Barracuda.
db_1 | 150301 14:54:42 InnoDB: Waiting for
the background threads to start
db_1 | 150301 14:54:43 InnoDB: 5.5.38 started;
log sequence number 1595675
db_1 | 150301 14:54:43 [Note] Server hostname
(bind-address): '0.0.0.0'; port: 3306
db_1 | 150301 14:54:43 [Note] - '0.0.0.0'
resolves to '0.0.0.0';
db_1 | 150301 14:54:43 [Note] Server socket
created on IP: '0.0.0.0'.
14
Docker compose
Docker registry & start by docker-compose
실행
[root@docker188 wordpress]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
oscinfra_web latest 4ea4c8b5cb7f 2 minutes ago 348.9 MB
osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB
localhost:5000/osc/osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB
osc_wordpress latest d590073094fd 3 hours ago 511.5 MB
localhost:5000/osc/osc_wordpress latest d590073094fd 3 hours ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 4 days ago 282.9 MB
docker.io/orchardup/php5 latest 7113324d9d9e 12 months ago 330.1 MB
[root@docker188 wordpress]# docker tag oscinfra_web localhost:5000/oscweb/oscinfra_web
[root@docker188 wordpress]# docker push localhost:5000/oscweb/oscinfra_web
The push refers to a repository [localhost:5000/oscweb/oscinfra_web] (len: 1)
Sending image list
Pushing repository localhost:5000/oscweb/oscinfra_web (1 tags)
511136ea3c5a: Image successfully pushed
e2aa6665d371: Image successfully pushed
f0ee64c4df74: Image successfully pushed
2209cbf9dcd3: Image successfully pushed
5e019ab7bf6d: Image successfully pushed
7113324d9d9e: Image successfully pushed
4ea4c8b5cb7f: Image successfully pushed
Pushing tag for rev [4ea4c8b5cb7f] on {http://localhost:5000/v1/repositories/oscweb/oscinfra_web/tags/latest}
15
Docker compose
Docker registry & start by docker-compose
실행
[root@docker188 wordpress]# docker-compose up
Creating wordpress_db_1...
Pulling image orchardup/mysql:latest...
ab3b99429ab1: Download complete
ab3b99429ab1: Pulling image (latest) from docker.io/orchardup/mysql
Status: Downloaded newer image for docker.io/orchardup/mysql:latest
Creating wordpress_web_1...
Building web...
Step 0 : FROM orchardup/php5
---> 7113324d9d9e
Step 1 : ADD . /code
---> 64a9cfc3a30a
Removing intermediate container 4c5bf7fbd928
Successfully built 64a9cfc3a30a
Attaching to wordpress_db_1, wordpress_web_1
……
db_1 | 150529 6:06:55 InnoDB: Waiting for the background threads to start
db_1 | 150529 6:06:56 InnoDB: 5.5.38 started; log sequence number 1595675
db_1 | 150529 6:06:56 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
db_1 | 150529 6:06:56 [Note] - '0.0.0.0' resolves to '0.0.0.0';
db_1 | 150529 6:06:56 [Note] Server socket created on IP: '0.0.0.0'.
db_1 | 150529 6:06:56 [Note] Event Scheduler: Loaded 0 events
db_1 | 150529 6:06:56 [Note] /usr/sbin/mysqld: ready for connections.
db_1 | Version: '5.5.38-0ubuntu0.12.04.1-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
16
Docker compose
Docker registry & start by docker-compose
실행
[root@docker188 ~]# docker commit -m "0528_status" -a "support@osci.kr" 0358aa2a848f wordpress_web_1_0528
Cd34d5a8b091dcf5b95f3eba1d702f55f591698d15d67b26762c0314b198db31
[root@docker188 ~]# docker commit -m "0528_status" -a "support@osci.kr" 2d20222e6afb mysql_1_0528
5c3f4110a1864995bd5c90287f0e8ccc5453b3cd5600ae532ab5ca322cf217d1
[root@docker188 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mysql_1_0528 latest 5c3f4110a186 20 seconds ago 292.3 MB
wordpress_web_1_0528 latest cd34d5a8b091 2 minutes ago 348.9 MB
wordpress_web latest 64a9cfc3a30a 18 minutes ago 348.9 MB
oscinfra_web latest 4ea4c8b5cb7f 25 minutes ago 348.9 MB
localhost:5000/oscweb/oscinfra_web latest 4ea4c8b5cb7f 25 minutes ago 348.9 MB
localhost:5000/osc/osc_mysql latest 967e48b02b99 4 hours ago 282.9 MB
osc_mysql latest 967e48b02b99 4 hours ago 282.9 MB
osc_wordpress latest d590073094fd 4 hours ago 511.5 MB
localhost:5000/osc/osc_wordpress latest d590073094fd 4 hours ago 511.5 MB
docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB
docker.io/mysql latest ff78d9bb5f46 4 days ago 282.9 MB
docker.io/orchardup/mysql latest ab3b99429ab1 9 months ago 292.3 MB
docker.io/orchardup/php5 latest 7113324d9d9e 12 months ago 330.1 MB
17
Docker Swarm
소개
Docker Native Clustering System
클러스터 / 컨테이너 / 이미지를 컨트롤
클러스터 그룹에서 비교적 쉬운 WorkLoad 제어
Docker API 지원
Swarm은 매니저 Docker Node는 클러스터의 노드
특별히 필요로 하는 인프라 조건은 없음
18
Docker Swarm
Swarm Host Install (Swarm Host에서 실행)
# yum install mercurial golang git
# mkdir ~/gocode; export GOPATH=~/gocode
# cd ~/gocode
# go get -u github.com/docker/swarm
Swarm Install Test
# ~/gocode/bin/swarm –help
19
Docker Swarm
Docker Node Install (Docker Node에서 실행)
# yum install docker
# vi /etc/sysconfig/docker 파일의 OPTIONS 항목에 -H 0.0.0.0:<포트>를 추가
# systemctl restart docker
/etc/sysconfig/docker 의 옵션
20
Docker Swarm
Setup Swarm Host (Swarm Host에서 실행)
# ~/gocode/bin/swarm create
(Swarm Cluster 를 생성합니다. 생성되는 ID는 따로 잘 보관하여야 합니다)
# ~/gocode/bin/swarm join --addr=<ip-of-node>:2375 token://<swarm_id>
(IP가 한번만 나타나면 바로 Ctrl + C 를 입력하여 취소하여도 상관없습니다)
# ~/gocode/bin/swarm list token://<swarm_id>
(Swarm에 등록된 노드들의 리스트를 확인합니다.)
# ~/gocode/bin/swarm --debug manage --host=0.0.0.0:2375 token://<swarm_id>
(Swarm Manager 시작)
Swarm Manager를 실행하는 도중 Duplicate Error 발생시는 /etc/docker/key.json 파일 or ~/.docker/key.json
파일을 삭제한 후 데몬을 재시작합니다.
클러스터 ID
클러스터에 참가되어 있는 Node
21
Docker Swarm
Docker 컨테이너 실행 (아무 노드에서나 수행)
1번Host에서 ubuntu bash 쉘 수행
2번Host에 컨테이너 기동
1번Host에 컨테이너 파일 없음
2번Host에 컨테이너 파일 확인
22
Docker Swarm
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
9fc314043a7f6960a98e1fd594c047b36aa8240da5a3bd341417aff5dcf2f648
[root@Docker-Host2 ~]#
[root@Docker-Host2 ~]#
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
6249d9581761bcd7b33fac05eee3ba62fea93e779558a690c23ebe73a73f0532
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
fdeea5649fccc1ef2786d12d08f38b58f0dc6ad0c45fe11b97385bb8eb4e93d1
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
080a90c0ca8f647455a69e2d0951d802008c5078c091a9940c2dd5267c574358
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
06cf2a484ea6ed893b5af7e1ac1163314bbe6ed8a55f439fe694e9353ba1054b
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
fb0e410202fd552529396418ac13279c68fc08a8e2e701898dcd07e221b4a92c
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
3817a06c550f9350db2bcf349342be8d0fa65010642844c455b725515cc2f694
[root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash
a2d5a13ce9f7e240f96ab06d838fb72b22f5e59664756de215ff9090e3199d25
[root@Docker-Host2 ~]#
Every 2.0s: docker -H 192.168.0.154:6644 ps Fri May 29 00:23:49 2015
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2d5a13ce9f7 centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host2/boring_pike
3817a06c550f centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host1/admiring_bell
fb0e410202fd centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host2/goofy_yalow
06cf2a484ea6 centos:latest "/bin/bash" 2 minutes ago Up About a minute Docker-Host1/stoic_colden
080a90c0ca8f centos:latest "/bin/bash" 2 minutes ago Up 2 minutes Docker-Host2/determined_hodgkin
fdeea5649fcc centos:latest "/bin/bash" 4 minutes ago Up 4 minutes Docker-Host2/thirsty_davinci
6249d9581761 centos:latest "/bin/bash" 4 minutes ago Up 4 minutes Docker-Host1/grave_mcclintock
9fc314043a7f centos:latest "/bin/bash" 5 minutes ago Up 4 minutes Docker-Host1/happy_shockley
2번Host에서 bash 쉘 수행
1번Host에서 모니터링 결과
23
Docker Swarm
Docker Swarm Architecture
Swarm Docker-Host1
Docker-Host2
Swarm-Cluster
Swarm 중앙 집중식 관리
각 노드의 커맨드는 클러스터를 커져 Swarm을 거쳐 최종 노드에서 수행
클러스터의 전략과 필터를 통하여 컨테이너 수행 제어
Listening / Sending
Port 6644
Sending
Port 6644
Sending
Port 6644
24
Docker Kubernetes
소개
Kubernetes는 여러 호스트에서 컨테이너 응용 프로그램을 관리하는 응용 프로그램의 배포, 유지 보수 및
확장을위한 기본 메커니즘을 제공하는 시스템이다.
Kubernetes 는 single master가 여러 node(minions)를 관리한다.
출처: http://www.cyworld.com/ruo91/8923965
- Etcd
kubernetes의 관련 된 정보를 담고
있는 Key/Value 저장소
Master
- Service proxy
설정한 Pod의 RR(Round Robin)을
담당하는 역할
Minion
- Kubelet
Minion을 제어하는 agent
- pod
Control하는 단위
25

Contenu connexe

Tendances

Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeDanielle Madeley
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructureDaegwon Kim
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochranedotCloud
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesSreenivas Makam
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 PresentationSreenivas Makam
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Leonid Mirsky
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker ComposeJustin Crown
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014André Rømcke
 
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfContinuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfJulia Mateo
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Alexey Petrov
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleRoman Rodomansky
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
Launching containers with fleet
Launching containers with fleetLaunching containers with fleet
Launching containers with fleet충섭 김
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCarlos Sanchez
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 

Tendances (20)

Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and code
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Docker Started
Docker StartedDocker Started
Docker Started
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014
 
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconfContinuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
Continuous delivery with Jenkins, Docker and Mesos/Marathon - jbcnconf
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
Dockerize Me: Distributed PHP applications with Symfony, Docker, Consul and A...
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Launching containers with fleet
Launching containers with fleetLaunching containers with fleet
Launching containers with fleet
 
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache MesosCI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 

En vedette

세미나
세미나세미나
세미나Dongyi Kim
 
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기Baekjoon Choi
 
Mesos on coreOS
Mesos on coreOSMesos on coreOS
Mesos on coreOS충섭 김
 
RancherOS Introduction
RancherOS IntroductionRancherOS Introduction
RancherOS IntroductionRemotty
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionRemotty
 
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & RankingIan Choi
 
형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영창훈 정
 
1.openseminar
1.openseminar1.openseminar
1.openseminarNAVER D2
 
5.yobi를 활용한 개발자 협업 및 배포 프로세스
5.yobi를 활용한 개발자 협업 및 배포 프로세스5.yobi를 활용한 개발자 협업 및 배포 프로세스
5.yobi를 활용한 개발자 협업 및 배포 프로세스NAVER D2
 
네이버 오픈세미나 백엔드_아키텍쳐
네이버 오픈세미나 백엔드_아키텍쳐네이버 오픈세미나 백엔드_아키텍쳐
네이버 오픈세미나 백엔드_아키텍쳐NAVER D2
 
2.네이버 프론트엔드 김지태
2.네이버 프론트엔드 김지태2.네이버 프론트엔드 김지태
2.네이버 프론트엔드 김지태NAVER D2
 

En vedette (12)

세미나
세미나세미나
세미나
 
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기
나는 어떻게 알고리즘을 공부했을까? + 신기한 방법으로 문제 풀어보기
 
Mesos on coreOS
Mesos on coreOSMesos on coreOS
Mesos on coreOS
 
RancherOS Introduction
RancherOS IntroductionRancherOS Introduction
RancherOS Introduction
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in Action
 
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking
집단 지성 (Programming collective intelligence) 스터디: Chapter 4 - Searching & Ranking
 
형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영형태소 분석기를 적용한 elasticsearch 운영
형태소 분석기를 적용한 elasticsearch 운영
 
1.openseminar
1.openseminar1.openseminar
1.openseminar
 
Arcus
ArcusArcus
Arcus
 
5.yobi를 활용한 개발자 협업 및 배포 프로세스
5.yobi를 활용한 개발자 협업 및 배포 프로세스5.yobi를 활용한 개발자 협업 및 배포 프로세스
5.yobi를 활용한 개발자 협업 및 배포 프로세스
 
네이버 오픈세미나 백엔드_아키텍쳐
네이버 오픈세미나 백엔드_아키텍쳐네이버 오픈세미나 백엔드_아키텍쳐
네이버 오픈세미나 백엔드_아키텍쳐
 
2.네이버 프론트엔드 김지태
2.네이버 프론트엔드 김지태2.네이버 프론트엔드 김지태
2.네이버 프론트엔드 김지태
 

Similaire à Docker orchestration

Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom imaget lc
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom imaget lc
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
Azure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish KalamatiAzure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish KalamatiGirish Kalamati
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionSysdig
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionAlper Kanat
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruSwaminathan Vetri
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Dockermsyukor
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 

Similaire à Docker orchestration (20)

Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom image
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom image
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Azure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish KalamatiAzure from scratch part 5 By Girish Kalamati
Azure from scratch part 5 By Girish Kalamati
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
 
DockerCoreNet
DockerCoreNetDockerCoreNet
DockerCoreNet
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Docker
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 

Docker orchestration

  • 1. 1 2015. 5. 28 ㈜ 오픈소스컨설팅 김호진,박현익 Using Docker and How to orchestrate it.
  • 2. 2 Contents 1. Container image 관리 1.1 Docker registry 2. Docker Compose 2.1 Compose install & define the project 2.2 PHP wordpress programming 3. Docker Swarm 2.3 Build by docker file 2.4 Docker registry & start by docker-compose 4. Docker Kubernetes
  • 3. 3 yum install docker-registry Create private Docker registries Docker local registry 만들기 [root@docker187 ~]# systemctl status docker.service [root@docker187 ~]# systemctl -l status docker-registry [root@docker187 ~]# docker login Username (oscinfra): WARNING: login credentials saved in /root/.dockercfg. Login Succeeded https://registry.hub.docker.com/repos/ [root@docker187 ~]# netstat -ntpl | grep 5000 tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN 729/python firewall-cmd --zone=public --list-services firewall-cmd --zone=public --list-ports firewall-cmd --permanent --zone=public --add- service=https firewall-cmd --permanent --zone=public --add- port=5000/tcp firewall-cmd --zone=public --add-port=5000/tcp firewall-cmd –reload [root@docker187 ~]# nmap localhost PORT STATE SERVICE 5000/tcp open upnp
  • 4. 4 yum install docker-registry Create private Docker registries Root image 가지고 오기 [root@docker188 ~]# docker pull mysql:latest latest: Pulling from docker.io/mysql [root@docker188 ~]# docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=qwerqwer -d mysql d10d4821e9b96f7f1f5065351f83e014f2799bf8b4febc9da6d3573d12f8aa4e [root@docker188 ~]# docker run --name wordpress-instance --link some-mysql:mysql -p 8000:80 -d wordpress edb109fc4ba635f77f9e506b786b3b5529f8d6b7fd6a12ab4adb53116907d02e [root@docker188 ~]# nmap localhost 5000/tcp open upnp 8080/tcp open http-proxy 출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/
  • 5. 5 yum install docker-registry Create private Docker registries Install 후 commit작업 실시 출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/
  • 6. 6 yum install docker-registry Create private Docker registries Install 후 commit작업 실시 [root@docker188 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 11 minutes ago Up 11 minutes 0.0.0.0:8080->80/tcp wordpress-instance d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 13 minutes ago Up 13 minutes 3306/tcp some-mysql [root@docker188 ~]# docker commit edb109fc4ba6 osc_wordpress 9655c5be2aa9013d72dc4908d38149e9938b03f32039f1bb89fe226ee9478a11 [root@docker188 ~]# docker commit d10d4821e9b9 osc_mysql d1341c6a3b5860cbb55d08e96e239224786e4c3767294e2d13705609a183f353 [root@docker188 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE osc_mysql latest d1341c6a3b58 About a minute ago 282.9 MB osc_wordpress latest 9655c5be2aa9 About a minute ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 44 hours ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB [root@docker188 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 14 minutes ago Exited (0) 36 seconds ago wordpress-instance d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 16 minutes ago Exited (0) 34 seconds ago some-mysql
  • 7. 7 yum install docker-registry Create private Docker registries Install 후 commit작업 실시 [root@docker188 ~]# docker stop `docker ps -qa` [root@docker188 ~]# docker run --name osc_mysql -e MYSQL_ROOT_PASSWORD='qwerqwer' -d osc_mysql d15491be7bc85bf764f1a2bb2c2b9d7c00e76e1eae476ee572ff52bc609daa68 [root@docker188 ~]# docker run --name osc_wordpress2 --link osc_mysql:mysql -p 8090:80 -d osc_wordpress 12dceb757464a858326658a8c8d26b45d5efa7631d47c7b33ac0bcc14d8bced6 [root@docker188 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 12dceb757464 osc_wordpress:latest "/entrypoint.sh apac 11 seconds ago Up 10 seconds 0.0.0.0:8080->80/tcp osc_wordpress2 d15491be7bc8 osc_mysql:latest "/entrypoint.sh mysq About a minute ago Up About a minute 3306/tcp osc_mysql edb109fc4ba6 wordpress:latest "/entrypoint.sh apac 17 minutes ago Exited (0) 3 minutes ago wordpress-instance d10d4821e9b9 mysql:latest "/entrypoint.sh mysq 19 minutes ago Exited (0) 3 minutes ago some-mysql
  • 8. 8 yum install docker-registry Create private Docker registries Commit후 private Docker registry에 등록 후 파일 전송 [root@docker188 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB osc_wordpress latest d590073094fd 2 hours ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB [root@docker188 ~]# docker tag osc_mysql:latest localhost:5000/osc/osc_mysql [root@docker188 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB localhost:5000/osc/osc_mysql latest 967e48b02b99 2 hours ago 282.9 MB osc_wordpress latest d590073094fd 2 hours ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB [root@docker188 ~]# docker push localhost:5000/osc/osc_mysql The push refers to a repository [localhost:5000/osc/osc_mysql] (len: 1) Sending image list 967e48b02b99: Image successfully pushed Pushing tag for rev [967e48b02b99] on {http://localhost:5000/v1/repositories/osc/osc_mysql/tags/latest}
  • 9. 9 yum install docker-registry Create private Docker registries Commit후 private Docker registry에 등록 후 파일 전송 [root@docker188 ~]# docker tag osc_wordpress localhost:5000/osc/osc_wordpress [root@docker188 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE localhost:5000/osc/osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB localhost:5000/osc/osc_wordpress latest d590073094fd 3 hours ago 511.5 MB osc_wordpress latest d590073094fd 3 hours ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 3 days ago 282.9 MB [root@docker188 ~]# docker push localhost:5000/osc/osc_wordpress The push refers to a repository [localhost:5000/osc/osc_wordpress] (len: 1) Sending image list Pushing repository localhost:5000/osc/osc_wordpress (1 tags) d590073094fd: Image successfully pushed Pushing tag for rev [d590073094fd] on {http://localhost:5000/v1/repositories/osc/osc_wordpress/tags/latest}
  • 10. 10 Docker Compose 소개 도커 복잡한 응용 프로그램을 정의하고 실행하기위한 도구입니다 멀티 컨테이너를 하나의 파일로 운용 하나의 command로 모든 doker file들 실행
  • 11. 11 Docker compose Compose install & define the project 출처 : http://www.infosiftr.com/2014/11/13/docker-tutorial-wordpress/ [root@docker188 ~]# curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker- compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 403 0 403 0 0 343 0 --:--:-- 0:00:01 --:--:-- 343 100 5140k 100 5140k 0 0 1031k 0 0:00:04 0:00:04 --:--:-- 1871k [root@docker188 ~]# chmod +x /usr/local/bin/docker-compose [root@docker188 ~]# curl https://wordpress.org/latest.tar.gz | tar -xvzf - [root@docker188 wordpress]# cat Dockerfile FROM orchardup/php5 ADD . /code [root@docker188 wordpress]# cat docker-compose.yml web: build: . command: php -S 0.0.0.0:8000 -t /code ports: - "8000:8000" links: - db volumes: - .:/code db: image: orchardup/mysql environment: MYSQL_DATABASE: wordpress
  • 12. 12 Docker compose Php wordpress programming 간단 program [root@docker01 wordpress]# cat wp-config.php <?php define('DB_NAME', 'wordpress'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_HOST', "db:3306"); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); define('AUTH_KEY', 'test'); define('SECURE_AUTH_KEY', 'test'); define('LOGGED_IN_KEY', 'test'); define('NONCE_KEY', 'test'); define('AUTH_SALT', 'test'); define('SECURE_AUTH_SALT', 'test'); define('LOGGED_IN_SALT', 'test'); define('NONCE_SALT', 'test'); $table_prefix = 'wp_'; define('WPLANG', ''); define('WP_DEBUG', false); if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); require_once(ABSPATH . 'wp-settings.php'); [root@docker01 wordpress]# cat router.php <?php $root = $_SERVER['DOCUMENT_ROOT']; chdir($root); $path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['p ath'],'/'); set_include_path(get_include_path().':'.__DIR__ ); if(file_exists($root.$path)) { if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/') $path = rtrim($path,'/').'/index.php'; if(strpos($path,'.php') === false) return false; else { chdir(dirname($root.$path)); require_once $root.$path; } }else include_once 'index.php';
  • 13. 13 Docker compose Build by docker file 실행 [root@docker188 wordpress]# docker build -t oscinfra_web . Sending build context to Docker daemon 19.79 MB Sending build context to Docker daemon Step 0 : FROM orchardup/php5 Trying to pull repository docker.io/orchardup/php5 ... 7113324d9d9e: Download complete 511136ea3c5a: Download complete e2aa6665d371: Download complete f0ee64c4df74: Download complete 2209cbf9dcd3: Download complete 5e019ab7bf6d: Download complete Status: Downloaded newer image for docker.io/orchardup/php5:latest ---> 7113324d9d9e Step 1 : ADD . /code ---> 4ea4c8b5cb7f Removing intermediate container 5ab560447a8b Successfully built 4ea4c8b5cb7f [root@docker188 wordpress]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE oscinfra_web latest 4ea4c8b5cb7f 10 seconds ago 348.9 MB [root@docker01 wordpress]# docker-compose up Creating wordpress_db_1... Pulling image orchardup/mysql:latest... Pulling repository orchardup/mysql 061b756f7e0d: Download complete Status: Downloaded newer image for orchardup/mysql:latest Creating wordpress_web_1... Building web... Step 0 : FROM orchardup/php5 ---> 7113324d9d9e .. db_1 | 150301 14:54:42 InnoDB: highest supported file format is Barracuda. db_1 | 150301 14:54:42 InnoDB: Waiting for the background threads to start db_1 | 150301 14:54:43 InnoDB: 5.5.38 started; log sequence number 1595675 db_1 | 150301 14:54:43 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 db_1 | 150301 14:54:43 [Note] - '0.0.0.0' resolves to '0.0.0.0'; db_1 | 150301 14:54:43 [Note] Server socket created on IP: '0.0.0.0'.
  • 14. 14 Docker compose Docker registry & start by docker-compose 실행 [root@docker188 wordpress]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE oscinfra_web latest 4ea4c8b5cb7f 2 minutes ago 348.9 MB osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB localhost:5000/osc/osc_mysql latest 967e48b02b99 3 hours ago 282.9 MB osc_wordpress latest d590073094fd 3 hours ago 511.5 MB localhost:5000/osc/osc_wordpress latest d590073094fd 3 hours ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 4 days ago 282.9 MB docker.io/orchardup/php5 latest 7113324d9d9e 12 months ago 330.1 MB [root@docker188 wordpress]# docker tag oscinfra_web localhost:5000/oscweb/oscinfra_web [root@docker188 wordpress]# docker push localhost:5000/oscweb/oscinfra_web The push refers to a repository [localhost:5000/oscweb/oscinfra_web] (len: 1) Sending image list Pushing repository localhost:5000/oscweb/oscinfra_web (1 tags) 511136ea3c5a: Image successfully pushed e2aa6665d371: Image successfully pushed f0ee64c4df74: Image successfully pushed 2209cbf9dcd3: Image successfully pushed 5e019ab7bf6d: Image successfully pushed 7113324d9d9e: Image successfully pushed 4ea4c8b5cb7f: Image successfully pushed Pushing tag for rev [4ea4c8b5cb7f] on {http://localhost:5000/v1/repositories/oscweb/oscinfra_web/tags/latest}
  • 15. 15 Docker compose Docker registry & start by docker-compose 실행 [root@docker188 wordpress]# docker-compose up Creating wordpress_db_1... Pulling image orchardup/mysql:latest... ab3b99429ab1: Download complete ab3b99429ab1: Pulling image (latest) from docker.io/orchardup/mysql Status: Downloaded newer image for docker.io/orchardup/mysql:latest Creating wordpress_web_1... Building web... Step 0 : FROM orchardup/php5 ---> 7113324d9d9e Step 1 : ADD . /code ---> 64a9cfc3a30a Removing intermediate container 4c5bf7fbd928 Successfully built 64a9cfc3a30a Attaching to wordpress_db_1, wordpress_web_1 …… db_1 | 150529 6:06:55 InnoDB: Waiting for the background threads to start db_1 | 150529 6:06:56 InnoDB: 5.5.38 started; log sequence number 1595675 db_1 | 150529 6:06:56 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 db_1 | 150529 6:06:56 [Note] - '0.0.0.0' resolves to '0.0.0.0'; db_1 | 150529 6:06:56 [Note] Server socket created on IP: '0.0.0.0'. db_1 | 150529 6:06:56 [Note] Event Scheduler: Loaded 0 events db_1 | 150529 6:06:56 [Note] /usr/sbin/mysqld: ready for connections. db_1 | Version: '5.5.38-0ubuntu0.12.04.1-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu)
  • 16. 16 Docker compose Docker registry & start by docker-compose 실행 [root@docker188 ~]# docker commit -m "0528_status" -a "support@osci.kr" 0358aa2a848f wordpress_web_1_0528 Cd34d5a8b091dcf5b95f3eba1d702f55f591698d15d67b26762c0314b198db31 [root@docker188 ~]# docker commit -m "0528_status" -a "support@osci.kr" 2d20222e6afb mysql_1_0528 5c3f4110a1864995bd5c90287f0e8ccc5453b3cd5600ae532ab5ca322cf217d1 [root@docker188 ~]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE mysql_1_0528 latest 5c3f4110a186 20 seconds ago 292.3 MB wordpress_web_1_0528 latest cd34d5a8b091 2 minutes ago 348.9 MB wordpress_web latest 64a9cfc3a30a 18 minutes ago 348.9 MB oscinfra_web latest 4ea4c8b5cb7f 25 minutes ago 348.9 MB localhost:5000/oscweb/oscinfra_web latest 4ea4c8b5cb7f 25 minutes ago 348.9 MB localhost:5000/osc/osc_mysql latest 967e48b02b99 4 hours ago 282.9 MB osc_mysql latest 967e48b02b99 4 hours ago 282.9 MB osc_wordpress latest d590073094fd 4 hours ago 511.5 MB localhost:5000/osc/osc_wordpress latest d590073094fd 4 hours ago 511.5 MB docker.io/wordpress latest 2bed879f48b4 2 days ago 511.5 MB docker.io/mysql latest ff78d9bb5f46 4 days ago 282.9 MB docker.io/orchardup/mysql latest ab3b99429ab1 9 months ago 292.3 MB docker.io/orchardup/php5 latest 7113324d9d9e 12 months ago 330.1 MB
  • 17. 17 Docker Swarm 소개 Docker Native Clustering System 클러스터 / 컨테이너 / 이미지를 컨트롤 클러스터 그룹에서 비교적 쉬운 WorkLoad 제어 Docker API 지원 Swarm은 매니저 Docker Node는 클러스터의 노드 특별히 필요로 하는 인프라 조건은 없음
  • 18. 18 Docker Swarm Swarm Host Install (Swarm Host에서 실행) # yum install mercurial golang git # mkdir ~/gocode; export GOPATH=~/gocode # cd ~/gocode # go get -u github.com/docker/swarm Swarm Install Test # ~/gocode/bin/swarm –help
  • 19. 19 Docker Swarm Docker Node Install (Docker Node에서 실행) # yum install docker # vi /etc/sysconfig/docker 파일의 OPTIONS 항목에 -H 0.0.0.0:<포트>를 추가 # systemctl restart docker /etc/sysconfig/docker 의 옵션
  • 20. 20 Docker Swarm Setup Swarm Host (Swarm Host에서 실행) # ~/gocode/bin/swarm create (Swarm Cluster 를 생성합니다. 생성되는 ID는 따로 잘 보관하여야 합니다) # ~/gocode/bin/swarm join --addr=<ip-of-node>:2375 token://<swarm_id> (IP가 한번만 나타나면 바로 Ctrl + C 를 입력하여 취소하여도 상관없습니다) # ~/gocode/bin/swarm list token://<swarm_id> (Swarm에 등록된 노드들의 리스트를 확인합니다.) # ~/gocode/bin/swarm --debug manage --host=0.0.0.0:2375 token://<swarm_id> (Swarm Manager 시작) Swarm Manager를 실행하는 도중 Duplicate Error 발생시는 /etc/docker/key.json 파일 or ~/.docker/key.json 파일을 삭제한 후 데몬을 재시작합니다. 클러스터 ID 클러스터에 참가되어 있는 Node
  • 21. 21 Docker Swarm Docker 컨테이너 실행 (아무 노드에서나 수행) 1번Host에서 ubuntu bash 쉘 수행 2번Host에 컨테이너 기동 1번Host에 컨테이너 파일 없음 2번Host에 컨테이너 파일 확인
  • 22. 22 Docker Swarm [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash 9fc314043a7f6960a98e1fd594c047b36aa8240da5a3bd341417aff5dcf2f648 [root@Docker-Host2 ~]# [root@Docker-Host2 ~]# [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash 6249d9581761bcd7b33fac05eee3ba62fea93e779558a690c23ebe73a73f0532 [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash fdeea5649fccc1ef2786d12d08f38b58f0dc6ad0c45fe11b97385bb8eb4e93d1 [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash 080a90c0ca8f647455a69e2d0951d802008c5078c091a9940c2dd5267c574358 [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash 06cf2a484ea6ed893b5af7e1ac1163314bbe6ed8a55f439fe694e9353ba1054b [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash fb0e410202fd552529396418ac13279c68fc08a8e2e701898dcd07e221b4a92c [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash 3817a06c550f9350db2bcf349342be8d0fa65010642844c455b725515cc2f694 [root@Docker-Host2 ~]# docker -H 192.168.0.154:6644 run -d -t -i centos /bin/bash a2d5a13ce9f7e240f96ab06d838fb72b22f5e59664756de215ff9090e3199d25 [root@Docker-Host2 ~]# Every 2.0s: docker -H 192.168.0.154:6644 ps Fri May 29 00:23:49 2015 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a2d5a13ce9f7 centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host2/boring_pike 3817a06c550f centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host1/admiring_bell fb0e410202fd centos:latest "/bin/bash" About a minute ago Up About a minute Docker-Host2/goofy_yalow 06cf2a484ea6 centos:latest "/bin/bash" 2 minutes ago Up About a minute Docker-Host1/stoic_colden 080a90c0ca8f centos:latest "/bin/bash" 2 minutes ago Up 2 minutes Docker-Host2/determined_hodgkin fdeea5649fcc centos:latest "/bin/bash" 4 minutes ago Up 4 minutes Docker-Host2/thirsty_davinci 6249d9581761 centos:latest "/bin/bash" 4 minutes ago Up 4 minutes Docker-Host1/grave_mcclintock 9fc314043a7f centos:latest "/bin/bash" 5 minutes ago Up 4 minutes Docker-Host1/happy_shockley 2번Host에서 bash 쉘 수행 1번Host에서 모니터링 결과
  • 23. 23 Docker Swarm Docker Swarm Architecture Swarm Docker-Host1 Docker-Host2 Swarm-Cluster Swarm 중앙 집중식 관리 각 노드의 커맨드는 클러스터를 커져 Swarm을 거쳐 최종 노드에서 수행 클러스터의 전략과 필터를 통하여 컨테이너 수행 제어 Listening / Sending Port 6644 Sending Port 6644 Sending Port 6644
  • 24. 24 Docker Kubernetes 소개 Kubernetes는 여러 호스트에서 컨테이너 응용 프로그램을 관리하는 응용 프로그램의 배포, 유지 보수 및 확장을위한 기본 메커니즘을 제공하는 시스템이다. Kubernetes 는 single master가 여러 node(minions)를 관리한다. 출처: http://www.cyworld.com/ruo91/8923965 - Etcd kubernetes의 관련 된 정보를 담고 있는 Key/Value 저장소 Master - Service proxy 설정한 Pod의 RR(Round Robin)을 담당하는 역할 Minion - Kubelet Minion을 제어하는 agent - pod Control하는 단위
  • 25. 25