5. Under the hood, Docker is built on the following components:
・The cgroup and namespacing capabilities of the Linux
kernel;
・AUFS, a powerful union filesystem with copy-on-write
capabilities;
・The Go programming language;
・lxc, a set of convenience scripts to simplify the creation of
Linux containers.
FUNTERACTIVE OPEN MEETING VOL.04
Docker?
https://github.com/docker/docker/blob/master/README.md#under-the-hood
7. Apps Apps
ゲストOS ゲストOS
仮想マシン仮想マシン
ユーザー空間
OS process process process
カーネル空間
FUNTERACTIVE OPEN MEETING VOL.04
VirtualBox
物理マシン
ハードウェアごと仮想化
8. ユーザー空間
カーネル空間
FUNTERACTIVE OPEN MEETING VOL.04
LXC
Linux Containers
物理マシン
Apps
OS
process
process
Apps
process
process
ユーザー空間を分割して仮想化
9. AUFS
DVD-ROM
FUNTERACTIVE OPEN MEETING VOL.04
AUFS
Another Union File System
File System
modify new
read-write
read-only
A’ B C
A’ C
A B
http://itpro.nikkeibp.co.jp/article/Keyword/20090209/324482/?SS=imgview&FD=-692683090&ST=oss
10. Docker file system
http://docs.docker.com/terms/layer/
FUNTERACTIVE OPEN MEETING VOL.04
Container
writable
!
Image
read-only
!
Base image
15. $ sudo docker run -i -t centos /bin/bash
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
container a52e5157470c
base image
process
process
centos
コンテナ作成
16. コンテナ内にwget入れる
$ yum install -y wget
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
container wget
base image
process
process
centos
17. FUNTERACTIVE OPEN MEETING VOL.04
コンテナをコミット
$ sudo docker ps -a
!
$ sudo docker commit a52e5157470c centos/wget
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a52e515747
0c centos:latest "/bin/
bash"
10 minutes
ago
Exited (0) 2
minutes
ago
agitated_poincare
docker ps -aで確認できる項目
18. read-onlyのイメージ
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
image centos/wget
base image
process
process
centos
19. centos/wgetを元に新規コンテナ
$ sudo docker run -i -t centos/wget /bin/bash
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
image centos/wget
base image
process
process
centos
container
921e5f3f895e
20. centos/wgetを元に新規コンテナ
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
image centos/wget
base image
process
process
centos
container
$ yum install -y vim
vim
21. vimを入れたコンテナをコミット
$ sudo docker commit 921e5f3f895e centos/vim
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
image centos/vim
image centos/wget
base image
process
process
centos
22. 複数のコンテナ起動
$ sudo docker run -i -t centos/wget /bin/bash
$ sudo docker run -i -t centos/vim /bin/bash
OS ユーザー空間
カーネル空間
物理マシン
FUNTERACTIVE OPEN MEETING VOL.04
container
image
image
base image
process
process
container
image
base image
process
process
centos/wget
centos/vim