I have been constantly battling with getting docker started on my iMac. Up until now, the easiest way to get up and running with Docker has been by using Docker toolbox (previously boot2docker). Docker toolbox made it significantly easier to get setup with Docker compared to the earlier days on a Mac, but it was still significantly flawed. Once up and running, it mostly worked well, but getting Mac OS X to connect to my Docker / Docker Server was a constant battle. Most of the time running “$ docker env” would work but more often than not I would have had to mess around and delete the virtual box image and re-create a new virtual box instance and hope my local environment would connect. In the worst cases I have to completely delete docker and restart over with a fresh install.
Today after logging into Docker Hub, I noticed that the new Docker for Mac has entered public beta. I had signed up to the private beta quite some time ago, however was never fortunate enough to get an invite. On paper, Docker for Mac looks significantly better. It uses a xhyve virtual Machine wrapped around the native OS X Hypervisor framework replacing the need for Virtual Box. This significantly simplifies and unifies the OS X networking and filesystem and the virtual machine – the ease of use and speed difference should be night and day.
After removing all traces of the old Docker Toolbox & Virtual Box I quickly downloaded and had Docker for Mac up and running. So first impressions… Not terrific, maybe my expectations with speed were to high. My first task was to rebuild my containers. This was as smooth as to be expected and to be honest I never paid attention to the speed. Where I was disappointed was when I went to import my MySQL database. The 1.2GB import was terribly slow, what usually took 3-4 minutes took at least 3x that (I walked out after waiting 10 minutes).
After using Docker for Mac for a few days – I’ve decided my initial performance fears to be null and void. Admittedly, I have since had a software update, although the change logs appear to be bug fixes rather than performance fixes. I haven’t had a chance to do any benchmarks between Docker toolbox and Docker for Mac, but have defiantly noticed a difference in speed when performing MySQL queries. For example, one inefficient query I did take notice of however took 500 – 600ms on toolbox now takes around 200ms – this on it’s own is not proof that Docker for Mac is faster than the previous solution, but it’s my impression from my day to day use. So, my biggest bug bear of Docker toolbox, the getting it running – is that fixed? I’m pleased to say YES! Now when I restart my machine docker is already loaded on start up and ready to go from the terminal! Just this makes it a worthy upgrade!
Docker for Mac still clearly needs the red ‘Beta’ stamp attached, there defiantly are bugs lingering around (It’s crashed once on me already) – but the road ahead is looking brighter for Mac developers.