Docker Toolbox/boot2docker/VirtualBoxを削除して、Docker for Mac (public beta)で生活していく

よりコンパクトでシンプルな生活のため、Docker Toolbox/boot2docker/VirtualBoxを削除して、Docker for Mac一本で生きていく準備をします。

## Requirements

- Intel Mac
- Mac OS X 10.11.5
- Docker Toolbox (Kitematic, Docker Machine, Docker Compose, Quickstart, boot2docker etc.)
- Oracle VM VirtualBox 5.0.14 (optional)

## Install Docker for Mac

1. Download dmg installer from [docker-for-mac](https://docs.docker.com/docker-for-mac/).
2. Extract the DMG and execute the binary.
3. Migrate Docker Machine environment from (GUI)

## Uninstall Docker Toolbox (macOS)
### Execute uninstall script from Docker Inc.

[docker/toolbox](https://github.com/docker/toolbox) offers their Toolbox uninstalling script (CLI):

```:sh
curl -sO https://raw.githubusercontent.com/docker/toolbox/371a106a9d58fa9badd4ab527d5f3cb2c2855abf/osx/uninstall.sh
sudo bash uninstall.sh
```

#### Results
```
Remove all Docker Machine VMs? (Y/N): y
Usage: docker-machine rm [OPTIONS] [arg...]

Remove a machine

Description:
   Argument(s) are one or more machine names.

Options:

   --force, -f	Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)
   -y		Assumes automatic yes to proceed with remove, without prompting further user confirmation
Error: Expected to get one or more machine names as arguments
Removing Applications...
Removing docker binaries...
Removing boot2docker.iso
Forget packages
Forgot package 'io.docker.pkg.docker' on '/'.
Forgot package 'io.docker.pkg.dockercompose' on '/'.
Forgot package 'io.docker.pkg.dockermachine' on '/'.
Forgot package 'io.boot2dockeriso.pkg.boot2dockeriso' on '/'.
All Done!
```

### Remove backups by Docker for Mac installer

![](https://docs.docker.com/docker-for-mac/images/docker-for-mac-and-toolbox.png)

Docker for Mac installer made backup and so let's remove all backups as follows:

```
$ ll /usr/local/bin/docker*.backup
-rwxr-xr-x  1 tnir  admin  4938393 Dec  5  2015 /usr/local/bin/docker-compose.backup*
-rwxr-xr-x  1 tnir  admin  9039648 Dec  1  2015 /usr/local/bin/docker-machine.backup*
-rwxr-xr-x  1 tnir  admin  9231840 Dec  5  2015 /usr/local/bin/docker.backup*
```

```
$ rm -i /usr/local/bin/docker*.backup
```

## Uninstall Oracle VM VirtualBox

1. Download the latest VirtualBox 5.0.xx for OS X host package (DMG) from https://www.virtualbox.org/wiki/Downloads
2. Follow [the uninstall instruction](https://www.virtualbox.org/manual/ch02.html#idm871)

#### Results
```
$ /Volumes/VirtualBox/VirtualBox_Uninstall.tool ; exit;

Welcome to the VirtualBox uninstaller script.

The following files and directories (bundles) will be removed:
    /Users/tnir/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist
    /usr/local/bin/VirtualBox
    /usr/local/bin/VBoxManage
    /usr/local/bin/VBoxVRDP
    /usr/local/bin/VBoxHeadless
    /usr/local/bin/vboxwebsrv
    /usr/local/bin/VBoxBalloonCtrl
    /usr/local/bin/VBoxAutostart
    /usr/local/bin/VBoxDTrace
    /usr/local/bin/vbox-img
    /Library/LaunchDaemons/org.virtualbox.startup.plist
    /Library/Python/2.6/site-packages/vboxapi/VirtualBox_constants.py
    /Library/Python/2.6/site-packages/vboxapi/VirtualBox_constants.pyc
    /Library/Python/2.6/site-packages/vboxapi/__init__.py
    /Library/Python/2.6/site-packages/vboxapi/__init__.pyc
    /Library/Python/2.6/site-packages/vboxapi-1.0-py2.6.egg-info
    /Library/Python/2.7/site-packages/vboxapi/VirtualBox_constants.py
    /Library/Python/2.7/site-packages/vboxapi/VirtualBox_constants.pyc
    /Library/Python/2.7/site-packages/vboxapi/__init__.py
    /Library/Python/2.7/site-packages/vboxapi/__init__.pyc
    /Library/Python/2.7/site-packages/vboxapi-1.0-py2.7.egg-info
    /Library/Application Support/VirtualBox/LaunchDaemons/
    /Library/Application Support/VirtualBox/VBoxDrv.kext/
    /Library/Application Support/VirtualBox/VBoxUSB.kext/
    /Library/Application Support/VirtualBox/VBoxNetFlt.kext/
    /Library/Application Support/VirtualBox/VBoxNetAdp.kext/
    /Applications/VirtualBox.app/
    /Library/Python/2.6/site-packages/vboxapi/
    /Library/Python/2.7/site-packages/vboxapi/

And the following KEXTs will be unloaded:
    org.virtualbox.kext.VBoxUSB
    org.virtualbox.kext.VBoxNetFlt
    org.virtualbox.kext.VBoxNetAdp
    org.virtualbox.kext.VBoxDrv

And the traces of following packages will be removed:
    org.virtualbox.pkg.vboxkexts
    org.virtualbox.pkg.virtualbox
    org.virtualbox.pkg.virtualboxcli

Do you wish to uninstall VirtualBox (Yes/No)?
yes

The uninstallation processes requires administrative privileges
because some of the installed files cannot be removed by a normal
user. You may be prompted for your password now...

Please enter your password:
unloading org.virtualbox.kext.VBoxUSB
unloading org.virtualbox.kext.VBoxNetFlt
unloading org.virtualbox.kext.VBoxNetAdp
unloading org.virtualbox.kext.VBoxDrv
Successfully unloaded VirtualBox kernel extensions.
Forgot package 'org.virtualbox.pkg.vboxkexts' on '/'.
Forgot package 'org.virtualbox.pkg.virtualbox' on '/'.
Forgot package 'org.virtualbox.pkg.virtualboxcli' on '/'.
Done.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...10 completed.

[Process completed]
```
```
$ which VBoxManage || echo "No VirtualBox"
No VirtualBox
```

## Final results

### Docker 1.12.0-rc2
```
$ docker version
Client:
 Version:      1.12.0-rc2
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   906eacd
 Built:        Fri Jun 17 20:35:33 2016
 OS/Arch:      darwin/amd64
 Experimental: true

Server:
 Version:      1.12.0-rc2
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   a7119de
 Built:        Fri Jun 17 22:09:20 2016
 OS/Arch:      linux/amd64
 Experimental: true
```

darwin/amd64!!!

### docker info
```
$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.12.0-rc2
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null host bridge overlay
Swarm: inactive
Runtimes: default
Default Runtime: default
Security Options: seccomp
Kernel Version: 4.4.13-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.954 GiB
Name: moby
ID: KJBH:UXY6:GC4G:VH66:IFBX:C72G:H4ZA:UFWN:WKBX:HN26:VZSA:HXM4
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 21
 Goroutines: 28
 System Time: 2016-06-25T09:00:30.549850203Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
```

Alpine 3.4!!!

## Summary

Docker for Macに切り替えても、これまで通りMachineもComposeもを使うことが可能です。それでは快適なDocker生活を。

```
$ docker-compose version
docker-compose version 1.8.0-rc1, build 9bf6bc6
docker-py version: 1.8.1
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.2h  3 May 2016
$ docker-machine version
docker-machine version 0.8.0-rc1, build fffa6c9
```

Toolboxとの比較は以下が参考になります。

- https://docs.docker.com/docker-for-mac/docker-toolbox/