Mac OSXではVirtualBoxやVMWareなどを使ってDockerを使えるようになっています。開発する際などに便利なのですが、若干の問題点もありました。特にファイル共有周りの問題が大きかったように思います。 そこで使ってみたいのがdinghyです。Mac OSX上でのDocker利用を便利に、簡単にしてくれるソフトウェアです。

dinghyの使い方

dinghyのインストールはHomebrewを使って行います。

$ brew tap codekitchen/dinghy
$ brew install dinghy
$ brew install docker docker-machine

そしてcreateサブコマンドを使ってVMを作ります。

$ dinghy create --provider virtualbox

後は通常のDockerとして使えます。コマンドヘルプは次の通りです。

$ dinghy help
Commands:
  dinghy create          # create the docker-machine VM
  dinghy destroy         # stop and delete all traces of the VM
  dinghy halt            # stop the VM and services
  dinghy help [COMMAND]  # Describe available commands or one specific command
  dinghy ip              # get the VM's IP address
  dinghy nfs             # start or stop the internal nfs daemon
  dinghy restart         # restart the VM and services
  dinghy shellinit       # returns env variables to set, should be run like $(dinghy shellinit)
  dinghy ssh [args...]   # ssh to the VM
  dinghy status          # get VM and services status
  dinghy up              # start the Docker VM and services
  dinghy upgrade         # upgrade the boot2docker VM to the newest available
  dinghy version         # display dinghy version

dinghyの特徴としては、ファイル共有実行の高速化があります。VMWareでは30秒、VirualBoxでは90秒程度かかっていたものが5秒に短縮されるとのことです。また、ファイルの変更を即座に通知できるので修正しながら確認のフローが早くなります。そして独自のDNSを使うことで、http://myrailsapp.docker:3000/ といったアドレスでアクセスできるようになったり、HTTP Proxyによってポート番号なしでのアクセスもサポートされるようになります。

Mac OSX上でDockerを使って開発環境を作っている方にお勧めのソフトウェアです。

dinghyはMac OSX用のオープンソース・ソフトウェア(MIT License)です。

codekitchen/dinghy: faster, friendlier Docker on OS X