Docker is Awesome

In a previous post, I covered some of the use cases for Vagrant. Vagrant is great at what it does, and I’ll continue to use it for VMs.

In my never-ending search to make life easier, I stumbled across Docker.

homepage-docker-logo

Docker is all about containers.

The Docker devs give the analogy that a Docker container is to code as a shipping container is to cargo.

shipping container

Having a self-contained, standardized method of distributing code/cargo provides more flexibility and automation.

This sounded cool.

There are quite a few Linux distributions out there, but there’s one thing they all have in common, the Linux kernel.

Containers VS Virtual Machines (VM)

Docker provides a higher-level interface to LXC. Containers can be known as operating system level virtualization. VMs attempt to recreate not only the operating system, but hardware, and everything in-between.

A virtual machine (VM) is a software implemented abstraction of the underlying hardware, which is presented to the application layer of the system.

Wikipedia

This creates quite a bit of overhead to spin up a VM. As a developer, 9 times out of 10, I don’t care much about virtualizing hardware, but I do care about replicating my application in multiple Linux environments for deployment.

Docker gives you exactly this.

When you create a Docker container, you create an isolated environment that shares only the operating system and the binaries/libraries needed for your application. This gives me the ability to develop in a Docker container on my laptop (Ubuntu), and then push the container to a remote server (CentOS) with no surprises.

Win.

Why bother with Vagrant?

Vagrant still has its uses. Installing Docker requires a Linux environment. For Windows/Mac devs, Docker recommends using Vagrant to create an Ubuntu VM, then install Docker on your Ubuntu VM. Virtualizationception.

a88

This method is generally good for test driving software before installing on your local machine. Also, anything requiring hardware virtualization/provisioning, Vagrant does a great job.

So…

Go check out the getting started tutorial and documentation to get rolling with Docker. You can probably think of tons of your own use cases. Leave some in the comments.