Last active
May 1, 2017 02:45
-
-
Save yamamoto-febc/68cf54b21c9a68909751c54d85710411 to your computer and use it in GitHub Desktop.
Moby/LinuxKit on さくらのクラウド ref: http://qiita.com/yamamoto-febc/items/1cb923a853dde665d39f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| usacloud config | |
| Setting SakuraCloud API Token => | |
| Enter token: # APIトークンを入力 | |
| Setting SakuraCloud API Secret => | |
| Enter secret: # APIシークレットを入力 | |
| Setting SakuraCloud Zone => | |
| Enter zone[is1a/is1b/tk1a/tk1v](default:tk1a): # ゾーン選択(空でOK) | |
| Written your settings to ~/.usacloud_config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go get -u github.com/docker/moby/src/cmd/moby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/linuxkit/linuxkit.git | |
| cd linuxkit | |
| make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kernel: | |
| image: "linuxkit/kernel:4.9.x" | |
| cmdline: "console=ttyS0 console=tty0 page_poison=1" | |
| init: | |
| - linuxkit/init:f71c3b30ac1ba4ef16c160c89610fa4976f9752f | |
| - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 | |
| - linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed | |
| onboot: | |
| - name: dhcpcd | |
| image: "linuxkit/dhcpcd:48e249ebef6a521eed886b3bce032db69fbb4afa" | |
| binds: | |
| - /var:/var | |
| - /tmp/etc:/etc | |
| capabilities: | |
| - CAP_NET_ADMIN | |
| - CAP_NET_BIND_SERVICE | |
| - CAP_NET_RAW | |
| net: host | |
| command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] | |
| trust: | |
| image: | |
| - linuxkit/kernel | |
| outputs: | |
| - format: kernel+initrd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cp example/minimal.yml sakura.yml | |
| vi sakura.yml | |
| # 一番下のoutputs部分を以下のように修正 | |
| #outputs: | |
| # - format: iso-bios |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| moby build sakura.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kernel: | |
| image: "linuxkit/kernel:4.9.x" | |
| cmdline: "console=ttyS0 console=tty0 page_poison=1" | |
| init: | |
| - linuxkit/init:63eed9ca7a09d2ce4c0c5e7238ac005fa44f564b | |
| - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 | |
| - linuxkit/containerd:18eaf72f3f4f9a9f29ca1951f66df701f873060b | |
| - linuxkit/ca-certificates:e091a05fbf7c5e16f18b23602febd45dd690ba2f | |
| onboot: | |
| - name: sysctl | |
| image: "linuxkit/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c" | |
| net: host | |
| pid: host | |
| ipc: host | |
| capabilities: | |
| - CAP_SYS_ADMIN | |
| services: | |
| - name: rngd | |
| image: "linuxkit/rngd:c42fd499690b2cb6e4e6cb99e41dfafca1cf5b14" | |
| capabilities: | |
| - CAP_SYS_ADMIN | |
| oomScoreAdj: -800 | |
| - name: dhcpcd | |
| image: "linuxkit/dhcpcd:48e249ebef6a521eed886b3bce032db69fbb4afa" | |
| binds: | |
| - /var:/var | |
| - /tmp:/etc | |
| capabilities: | |
| - CAP_NET_ADMIN | |
| - CAP_NET_BIND_SERVICE | |
| - CAP_NET_RAW | |
| net: host | |
| oomScoreAdj: -800 | |
| - name: sackerel | |
| image: "sacloud/sackerel:latest" | |
| capabilities: | |
| - all | |
| net: host | |
| pid: host | |
| env: | |
| - "SAKURACLOUD_ACCESS_TOKEN=さくらのクラウドAPIトークンを入力" | |
| - "SAKURACLOUD_ACCESS_TOKEN_SECRET=さくらのクラウドAPIシークレットを入力" | |
| - "MACKEREL_APIKEY=MackerelのAPIキーを入力" | |
| trust: | |
| image: | |
| - linuxkit/kernel | |
| - linuxkit/rngd | |
| outputs: | |
| - format: iso-bios |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| brew tap sacloud/homebrew-usacloud; brew install usacloud |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ usacloud -v | |
| usacloud version 0.0.8, build 4934960 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| usacloud server rm -f -y moby_example | |
| usacloud iso-image rm -y moby_example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # mobyで作成したISOイメージをアップロードする | |
| usacloud iso-image create -y --name moby_example --iso-file sakura.iso | |
| # ディスクレスなサーバを作成(まだ起動させない) | |
| usacloud server build -y \ | |
| --name moby_example \ | |
| --disk-mode diskless \ | |
| --disable-boot-after-create | |
| # 空のディスクを作成 | |
| usacloud disk create -y --name moby_example | |
| # サーバとディスクを接続 | |
| usacloud server disk-connect -y \ | |
| --disk-id `usacloud disk read -q moby_example | head -n1` \ | |
| moby_example | |
| # サーバにISOイメージを挿入 | |
| usacloud server iso-insert -y \ | |
| --iso-image-id `usacloud iso-image read -q moby_example | head -n1` \ | |
| moby_example | |
| # 起動 | |
| usacloud server boot -y moby_example | |
| # 起動したサーバのコンソールに接続(さくらのクラウドのVNCプロキシを経由して接続) | |
| usacloud server vnc -y moby_example | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # mobyで作成したISOイメージをアップロードする | |
| usacloud iso-image create -y --name moby_example --iso-file sakura.iso | |
| # ディスクレスなサーバを作成(ISOイメージを挿入し、作成後起動する) | |
| usacloud server build -y \ | |
| --name moby_example \ | |
| --disk-mode diskless \ | |
| --iso-image-id `usacloud iso-image read -q moby_example | head -n1` | |
| # 起動したサーバのコンソールに接続(さくらのクラウドのVNCプロキシを経由して接続) | |
| usacloud server vnc -y moby_example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| usacloud server rm -f -y moby_example | |
| usacloud iso-image rm -y moby_example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment