How To Avoid Server Sprawl With Docker

When virtualisation was first mainstreamed, it changed the way we managed the server room. We saved money by consolidating servers into larger virtual hosts. Hardware-related downtime dropped because we could afford to spend money on redundancy and quality. Even mundane issues such as rack space and datacenter air conditioning became less of an expense. As system administrators, we could suddenly "create" a new server out of thin air.

Picture: Getty Images/Matt Cardy

And we did. Boy, did we ever. In fact, in a few short years, we turned our highly efficient server rooms into virtual server racks with twice as many "servers" as we had before, and twice as much maintenance was required to keep them running! Sure, we had fewer problems with noisy CPU fans and flaky power supplies, but the trade off was dozens of extra servers to keep updated and troubleshoot when they inevitably had problems.

In truth, the way we think about servers and the services they host has drastically changed. It's common to spin up an entire server for a single task. It's far easier to create an entire server instance for a web app than to worry about what version of PHP the application requires, and how that will work with other web applications in your environment. If every application has its own server, there's no worry about conflicts. Plus, if one server goes down it doesn't affect the other applications.

As a side effect, because we have multiple systems with various versions of PHP, MySQL, Apache, Java and so on, we have to maintain those systems individually. In fact, we have to keep track of which servers should be updated, which shouldn't, and how to handle security for systems -- depending on older software dependencies!

I like to call this phenomenon "virtual machine sprawl". It has turned into a huge problem for IT departments, because it means more servers to maintain, more systems to secure, and more single points of failure. The advantages offered by consolidating physical servers into VMs backfired, and created more work than ever before.

Thankfully, we're not doomed to continued server sprawl. By combining the advantages of both virtualisation and traditional multi-use servers, modern IT professionals are turning to "container" technology, specifically Docker containers.

Containers aren't new tech. The concept has been around for a while, but only with the slick Docker interface has it really become mainstream. Containers work much like a traditional server hosting many applications. This eliminates the need for multiple operating system installs, and means far less maintenance.

The difference is that instead of relying on dependencies installed on the main system, container-based (or "Dockerized") apps run inside their own environment. It's not a separate server, but it's a separate, isolated universe.

From the host machine's perspective, it means the same server can host applications that need PHP version 4, PHP version 5, and four different Java Runtime Environments, without ever conflicting. The applications all run on the same server, but from a filesystem perspective, they never see each other.

As if the power and efficiency of containers isn't enough, Docker comes along and makes the process painless! Either download a pre-made Docker image to get yourself a fully working Java Tomcat environment, or write a simple Dockerfile to build your own custom container within minutes.

The concept of virtualisation is certainly here to stay, and Docker doesn't replace the functionality virtual hosts provide. Migrating hot servers across hosts and hosting multiple operating systems (Windows, Linux, OSX) or load balancing servers in real time is still something that can only be done inside a VM environment such as VMWare's ESX. The tendency of administrators to keep installing servers over and over, however, can be alleviated by utilising the application-stacking ability of Docker. Containers aren't replacing virtual machine technology. Rather they're making them efficient once again!

Docker is available for Linux, Windows, and OSX. While it's not currently possible to host applications cross-platform, it is possible to stack many applications onto a single server, and host multiple Docker hosts inside a single virtual host. So while Windows-based Docker apps still have to run on a Windows machine, and Linux on Linux, by combining virtual machines and Docker containers, it's possible and quite practical to run them all on the same physical machine.

If you find yourself managing more servers in a virtual environment than you ever had to maintain on bare metal, I urge you to check out Docker. It provides a great way to get more use out of individual servers, and has the added benefit of returning hardware virtualisation back to its incredibly efficient origins!

Shawn Powers is a trainer with CBT Nuggets. Follow him on Twitter @shawnp0wers


Comments

Join the discussion!