LoginSignup
172
117

More than 5 years have passed since last update.

Docker for Macのディスクスループットを約2倍にする

Last updated at Posted at 2018-01-24

2018-08-06 15:38 Stable版で復活のお知らせ

Docker Community Edition 18.06.0-ce-mac70 2018-07-25 にて再度rawフォーマットが利用可能になりました。

Re-enable raw as the the default disk format for users running macOS 10.13.4 and higher. Note this change only takes effect after a “reset to factory defaults” or “remove all data” (from the Whale menu -> Preferences -> Reset). Related to docker/for-mac#2625

実際には、 Reset disk imageReset to factory defaults でrawフォーマットになります。

image.png

今度こそrawフォーマットを堪能しましょう。
@jca02266 さん情報ありがとうございます!

2018-06-08 02:01 Edge版で復活のお知らせ

Docker Community Edition 18.05.0-ce-rc1-mac63 2018-04-26 (Edge) にて再度rawフォーマットが利用可能になっていました。

Re-enable raw as the the default disk format for users running macOS 10.13.4 and higher. Note this change only takes effect after a “reset to factory defaults” or “remove all data” (from the Whale menu -> Preferences -> Reset). Related to docker/for-mac#2625

Stable版ではまだリリースされていません。Stable版にも来たら変更通知付きでまた更新します。

@takecore@github さん情報ありがとうございます!

2018-03-01 13:35 revert のお知らせ

バグがある為 Docker Community Edition 17.12.0-ce-mac55 2018-02-27 (Stable) にてrevertされました。

Revert the default disk format to qcow2 for users running macOS 10.13 (High Sierra). There are confirmed reports of file corruption using the raw format which uses sparse files on APFS. Note this change only takes effect after a reset to factory defaults (from the Whale menu -> Preferences -> Reset). Related to docker/for-mac#2625

以下元の投稿

Docker for Macのリリースノートを見てたら、

For systems running APFS on SSD on High Sierra, use raw format VM disks by default. This improves disk throughput (from 320MiB/sec to 600MiB/sec in dd on a 2015 MacBook Pro) and disk space handling.
Existing disks are kept in qcow format, if you want to switch to raw format you need to “Remove all data” or “Reset to factory defaults”

Docker Community Edition 17.12.0-ce-mac46 2018-01-09 (Stable)

Docker Community Edition 17.12.0-ce-mac46 2018-01-09 (Stable)の更新で、ディスクスループットが320MiB/secから600MiB/secになるらしいので適用する。

APFS, SSD, High Sierraで有効。
もう適用してしまったため効果測定できてないが、手順だけここにメモ。

一度初期化を行う

現状確認。
Disk image locationを見ると拡張子がqcow2になっている。

68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f39343333322f65323731356633332d633639622d306535652d303435622d3437346133336536626130332e706e67.png

仮想ディスクフォーマットを変更するには、一度Remove all dataまたはReset to factory defaultsを行う必要がある。
Reset to factory defaultsを行うと、使用CPUや使用メモリなどの設定も初期化されてしまうので、Remove all data を実施する。

image.png

新しいフォーマットで仮想ディスクイメージを作ってみる。

試しに $ docker run hello-world して新しい仮想ディスクイメージのフォーマットを確認してみる。

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:66ef312bbac49c39a89aa9bcc3cb4f3c9e7de3788c944158df3ee0176d32b751
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

仮想ディスクイメージのlocationを確認してみると、拡張子がrawに変わっていることを確認。

68747470733a2f2f71696974612d696d6167652d73746f72652e73332e616d617a6f6e6177732e636f6d2f302f39343333322f38623161323739642d353062332d336236392d313634622d6336653936613064306361632e706e67.png

試しにddコマンド

事後しかないけど、 ddコマンドで10GB書き込んだ際のログを残しておきます。

  • MacBook Pro (Retina, 13-inch, Early 2015)
  • 2.7 GHz Intel Core i5
  • 8 GB 1867 MHz DDR3
$ docker run -it alpine time dd if=/dev/zero of=/test bs=262144 count=40960
40960+0 records in
40960+0 records out
real    1m 5.46s
user    0m 0.32s
sys     0m 36.67s
172
117
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
172
117