SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
22.
Apps
Bin/Libs
Guest OS
Hypervisor
Host OS
Server
Apps
Guest OS
VM
VM
Bin/Libs
VM
Apps
Bin/Libs
Guest OS
VM
同じ独立性を確保しながら、よ
り少ないリソースで動作する
Apps
Bin/Libs
Apps
Bin/Libs
Apps
Bin/Libs
Docker Engine
Host OS
Server
Container
Container
Container
VMとコンテナ
Container
kernelは共有
23.
コンテナの動作
Container Process Container
Docker Engine
Host OS
Server
Process
process A
process B
process C Docker EngineがHost OSから
各リソースを隔離する
Process
28.
boot2docker
Process
Container
Process
Container
Process
Docker Daemon
boot2docker (linux)
TCP 2375
Docker
Command VirtualBox
Mac OS X
APIを使ってDockerを制御
Mac用DockerはAPIを呼ぶよ
うに作られている
43.
Docker!le
Docker!le
FROM centos:centos6
MAINTAINER Masahiro Nagano <kazeburo@gmail.com>
RUN yum install -y http://download.fedoraproject.org/
pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN yum install -y sl
CMD sl
元となるイメージ
build時に実行する
コマンド
docker run時に
実行するコマンド
44.
Dockerイメージの作成 #0
Mac OS X
$ ls
Dockerfile Vagrantfile
$ vagrant ssh
Guest OS
$ cd /vagrant
$ ls
Dockerfile Vagrantfile
$ docker build -t localdev/sl .
自動でGuestOSに
マウントされる
イメージに付けるTag名
52.
差分イメージの枝構造
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y sl
CMD sl
centos6
base
epel
sl
CMD
53.
差分イメージの枝構造
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y sl
CMD sl
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y fortune
CMD fortune
centos6
base
epel
sl
CMD
54.
差分イメージの枝構造
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y sl
CMD sl
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y fortune
CMD fortune
centos6
base
epel
sl
CMD
55.
差分イメージの枝構造
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y sl
CMD sl
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y fortune
CMD fortune
centos6
base
epel
sl
Docker!leに変更を加えると
そこから枝が分かれる。
幹は共有する
CMD
56.
差分イメージの枝構造
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y sl
CMD sl
FROM centos:centos6
RUN yum install -y epel.rpm
RUN yum install -y fortune
CMD fortune
centos6
base
epel
sl fortune
Docker!leに変更を加えると
そこから枝が分かれる。
幹は共有する
CMD CMD
75.
System Perl
Guest OS
$ docker run -i -t ubuntu:14.04 bash
root@8ac58f29a17a:/# perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for
x86_64-linux-gnu-thread-multi
(with 41 registered patches, see perl -V for more detail)
Copyright 1987-2013, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
root@8ac58f29a17a:/#
ubuntuの場合
76.
System Perl
Guest OS
$ docker run -i -t centos:centos6 bash
CentOSの場合
77.
System Perl
Guest OS
$ docker run -i -t centos:centos6 bash
bash-4.1# perl -v
CentOSの場合
78.
System Perl
Guest OS
$ docker run -i -t centos:centos6 bash
bash-4.1# perl -v
bash: perl: command not found
bash-4.1#
CentOSの場合
CentOSはイメージサイズを小さくする
ために perl は削られている!
92.
kazeburo/perl の使い方
Guest OS
$ docker run -i -t kazeburo/perl:v5.18 perl -v
This is perl 5, version 18, subversion 1 (v5.18.1) built for
x86_64-linux
Copyright 1987-2013, Larry Wall
..
$
93.
kazeburo/perl の使い方
Docker!le
FROM kazeburo/perl:v5.18
RUN cpanm -n Plack
CMD plackup -v
cpanmも導入済み
GuestOS
$ docker build -t localdev/perl .
$ docker run localdev/perl
Plack 1.0031
$