rabbit-slide-znz-about-boot2docker-format-me 2018.01.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a521607f35bf787b6e1c99cc579e4af1707a9f88
4
+ data.tar.gz: 2845f33bc961577a44b0946b76b8e610d1887c49
5
+ SHA512:
6
+ metadata.gz: 775631782c293e63a9a0d60226e366f866dde9ee51f53ebaeb9e931c7908867e7b9d9c1d03ba30702b42f0469a63a6e0c9143ec2372ba7846685effa70257506
7
+ data.tar.gz: 8a9d1fb3c6bc83b5e2e389a86788ded5cbffb21b57a033169ae1605d38da18a22236fd622935c0453a09bdf229e3cd778558c8dcb006403e30a88283acd785f3
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ boot2docker-format-me.md
@@ -0,0 +1,24 @@
1
+ # boot2docker の format-me の話
2
+
3
+ [LILO, 東海道らぐ, openSUSE MeetUP and 関西Debian 勉強会 LT大会](https://debianjp.connpass.com/event/76814/)での発表資料です。
4
+
5
+ ## For author
6
+
7
+ ### Show
8
+
9
+ rake
10
+
11
+ ### Publish
12
+
13
+ rake publish
14
+
15
+ ## For viewers
16
+
17
+ ### Install
18
+
19
+ gem install rabbit-slide-znz-about-boot2docker-format-me
20
+
21
+ ### Show
22
+
23
+ rabbit rabbit-slide-znz-about-boot2docker-format-me.gem
24
+
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # spec.files += Dir.glob("doc/**/*.*")
9
+ # spec.files -= Dir.glob("private/**/*.*")
10
+ # spec.add_runtime_dependency("YOUR THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
@@ -0,0 +1,106 @@
1
+ # boot2docker の format-me の話
2
+
3
+ author
4
+ : Kazuhiro NISHIYAMA
5
+
6
+ content-source
7
+ : LILO, 東海道らぐ, openSUSE MeetUP and 関西Debian 勉強会 LT大会
8
+
9
+ date
10
+ : 2018/01/28
11
+
12
+ allotted-time
13
+ : 10m
14
+
15
+ theme
16
+ : lightning-simple
17
+
18
+ # 自己紹介
19
+
20
+ - Ruby コミッターなど
21
+ - Twitter, GitHub: `@znz`
22
+
23
+ # boot2docker とは?
24
+
25
+ - Docker 専用軽量ディストリビューション
26
+ - v18.01.0-ce で 45MB の iso
27
+ - https://github.com/boot2docker/boot2docker/releases
28
+ - 昔は独自の cli で使用
29
+ - 今は Docker Machine が一般的
30
+ - VirtualBox, Hyper-V の時に boot2docker を使用
31
+
32
+ # 仕組み
33
+
34
+ - VirtualBox で VM 作成
35
+ - ISO から起動
36
+ - 仮想 HDD に書き込みが必要なデータを保存
37
+ - バージョンアップが ISO の差し替えと再起動だけで可能
38
+
39
+ # format-me?
40
+
41
+ - 仮想 HDD を初期化するためのトリック
42
+ - https://github.com/boot2docker/boot2docker/blob/master/rootfs/rootfs/etc/rc.d/automount
43
+ - パーティションテーブルがなければ、先頭が `boot2docker, please format-me` なのを確認して HDD をフォーマット
44
+
45
+ # 作成側 (1) tar を作成
46
+
47
+ - tar の内容
48
+ - `"boot2docker, please format-me"` というファイル名と内容のファイルが先頭
49
+ - 続いて公開鍵を `".ssh/authorized_keys"` と `".ssh/authorized_keys2"` として追加
50
+
51
+ # 作成側 (1) 実装箇所
52
+ - https://github.com/docker/machine/blob/49dfaa70fdc869c65d9f6c50c355624356ab383b/libmachine/mcnutils/b2d.go#L488
53
+ - https://github.com/boot2docker/boot2docker-cli/blob/master/virtualbox/machine.go
54
+
55
+ # 作成側 (2) VMDK 作成
56
+
57
+ - `VBoxManage convertfromraw stdin path size --format VMDK`
58
+ - 標準入力に tar の内容
59
+ - tar そのままをディスクの内容として作成
60
+
61
+ # 作成側 (2) 実装箇所
62
+
63
+ - https://github.com/docker/machine/blob/e1a03348ad83d8e8adb19d696bc7bcfb18ccd770/drivers/virtualbox/disk.go
64
+ - https://github.com/boot2docker/boot2docker-cli/blob/8a3999640ae7be3493c80a02203eba8c381d2d5c/virtualbox/disk.go
65
+
66
+ # 気になった点 (1) 疑問点
67
+
68
+ - tar が偶然 MBR などと誤認識されないか?
69
+ - MBR は先頭 512 バイトの末尾が 55 AA
70
+
71
+ # 気になった点 (1) tar 調査
72
+
73
+ - http://www.redout.net/data/tar.html によると tar ヘッダーが 512 バイトで末尾は prefix
74
+ - ファイル名は `"boot2docker, please format-me"` なので prefix の末尾2バイトはゼロ
75
+
76
+ # 気になった点 (1) MBR 調査
77
+
78
+ - MBR の 55 AA になることはない
79
+ - GPT も先頭は MBR 互換なので大丈夫
80
+ - パーティションテーブルと誤認識される可能性はなさそう
81
+
82
+ # 気になった点 (2) 疑問点
83
+
84
+ - 先頭 4096 バイトを `/userdata.tar` として保存しているのは大丈夫?
85
+ - 内容に関係なく無条件に 4096 バイト
86
+
87
+ # 気になった点 (2) tar 調査
88
+
89
+ - http://www.redout.net/data/tar.html によると、末尾にバイナリーゼロ (1024 バイト) がつくらしい
90
+ - 末尾を読みすぎるのは大丈夫そう
91
+
92
+ # 気になった点 (2) 内容
93
+
94
+ - 公開鍵が大きすぎるとはみ出しそう
95
+ - https://github.com/docker/machine/blob/ab3b7acb9792271dcd349da731150757a9346183/libmachine/ssh/keys.go で自前で 2048 ビット固定の RSA 鍵を作っていたので大丈夫そう
96
+ - カスタマイズして 4096 ビットにするとダメかも (ビルドが面倒そうで試してない)
97
+
98
+ # 気になった点 (2) 続き
99
+
100
+ - `authorized_keys2` はもう不要そうなので削っても良さそう
101
+ - 楕円曲線暗号の鍵にすれば、小さくできそう
102
+
103
+ # まとめ
104
+
105
+ - boot2docker は docker-machine で使われている
106
+ - 初回起動時に HDD の先頭をチェックして自動フォーマットしている
@@ -0,0 +1,20 @@
1
+ ---
2
+ id: about-boot2docker-format-me
3
+ base_name: boot2docker-format-me
4
+ tags:
5
+ - linux
6
+ presentation_date: 2018/01/28
7
+ version: 2018.01.28
8
+ licenses: []
9
+ slideshare_id: boot2docker-formatme
10
+ speaker_deck_id: boot2docker-false-format-me-falsehua
11
+ ustream_id:
12
+ vimeo_id:
13
+ youtube_id:
14
+ author:
15
+ markup_language: :markdown
16
+ name: Kazuhiro NISHIYAMA
17
+ email: zn@mbf.nifty.com
18
+ rubygems_user: znz
19
+ slideshare_user: znzjp
20
+ speaker_deck_user: znz
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-znz-about-boot2docker-format-me
3
+ version: !ruby/object:Gem::Version
4
+ version: 2018.01.28
5
+ platform: ruby
6
+ authors:
7
+ - Kazuhiro NISHIYAMA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: "[LILO, 東海道らぐ, openSUSE MeetUP and 関西Debian 勉強会 LT大会](https://debianjp.connpass.com/event/76814/)での発表資料です。"
28
+ email:
29
+ - zn@mbf.nifty.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - boot2docker-format-me.md
38
+ - config.yaml
39
+ - pdf/about-boot2docker-format-me-boot2docker-format-me.pdf
40
+ homepage: http://slide.rabbit-shocker.org/authors/znz/about-boot2docker-format-me/
41
+ licenses: []
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.6.14
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: boot2docker の format-me の話
63
+ test_files: []