About the author: David Kanenwisher is Myriad Mobile’s Lead Web Software Engineer. When not working on fun web projects for clients, Myriad’s marketing team convinces him to write blogs about software. Here is one of them!
Not Just Docker
If you know what Docker Toolbox is you may be wondering why it’s even necessary to do an assessment of it. I agree. Since replacing boot2docker it’s become pretty much the only reasonable way to build docker containers. This is especially true if you’re not on Linux. I do feel it’s necessary to “assess” Docker Toolbox. Primarily, because it’s a good idea to take a closer look at what’s in the toolbox. So what is in Docker Toolbox then?
The Docker Toolbox includes:
- Docker Engine
I’ll walk through what each of these tools are based on what I found in the official documentation.
Docker Engine is the heart of Docker. It’s responsible for building and running your Docker Containers. It also serves as the layer between the Docker containers and the host OS they are running on. Clearly, it’s something you’re going to want if you are going to be using Docker.
Compose allows you to configure and run multi-container Docker applications. This is really cool because it actually allows you to define all of the services an application needs in a single file, docker-compose.yml. Then you can run these with a single command ‘docker-compose up’.
There are four key features the Docker documentation points out:
- Multiple isolated environments on a single host.
- Preserve volume data when containers are created.
- Only recreate containers that have changed.
- Variables and moving a composition between environments.
While I’ll say features one and four are pretty great, I have to be honest, it’s features two and three that have me pretty stoked. From the sound of those two features it would be possible for us to setup development environments entirely in Docker rather than Vagrant. Vagrant is great yet I would prefer to be developing in the containers are code is actually deploying to. There would be practically zero concern about the environments diverging in unexpected ways. Plus, this would allow us to configure the unit testing environments in the same way.
Regrettably, you probably find yourself developing on OS X. Sadly for OS X it doesn’t support all of the kernel features necessary for containers to do their thing. This means that you can’t run Docker on the machine. Now, in the bad old days you’d have to run do all of your docker work in virtual machine by SSHing into. This is often clunky and always left something wanting since you had to manage things like forwarding ports and copying files to and from the VM. Of course, Machine doesn’t make Docker containers magically work on OS X.
Instead, Machine provides the tools necessary to make using a virtual machine to run Docker feel like you are running on the host OS. This isn’t without the occasional hiccup but when that happens you can just throw the old Machine VM away and bring up a new one. Machine and Docker Engine are pretty much the reasons you want Docker Toolbox.
Wait though, there’s more!
Machine is also able to manage remote VMs running Docker. Machine can quickly bring up and provision hosts in Digital Ocean, AWS, or Azure. I have not used it for this myself but it sounds pretty slick.
Not a fan of the command line? Do you prefer a little bit of clicky-clicky? Then Kitematic is your tool. Kitematic is the GUI for Docker. From browsing their website it looks it actually does some neat things.
By using Kitematic you can do basic things like:
- See a list of containers.
- Create a new container from images on Docker Hub.
- Start and stop containers.
- View logs.
- Get terminal access.
- Managing environment variables.
These are pretty cool features to have in Docker GUI and are reason enough to use it if you prefer a GUI over the command line. Kitematic has a few more tricks up it’s sleeve that make it worth taking a look at even if you use the command line. These most bodacious features of are the ability:
- Map the volume’s of your containers to shared folders in Finder.
- Change a container’s working directory to the location of your project files.
- Preview websites served by containers if it exposes a common web port.
If you’re going to use Docker you pretty much have to use Docker Toolbox. That being said, if you’re like me, you may have only cared that it included Docker Engine and Machine. On closer inspection Compose and Kitematic are two tools that I’d completely overlooked before that I wish I hadn’t.
As a web team we should seriously consider using Compose to manage our development environments. In order to avoid surprises, I personally prefer to be as close as possible to my production environment.
Also, it probably wouldn’t hurt, even for those of us who love our shell, to take a look at Kitematic. Not only does having a GUI sometimes reveal basic features normally hidden in the ‘–help’ but the additional features may just surprise us with their usefulness.