Avoid "Environment Hell" with Docker Containers

January 6, 2014 Jeff Douglas

docker How often has this scenario occurred during your development career? You have a web app running Java SE 6 Update 37, Jersey, Tomcat 7 and MongoDB that you’ve developed with love and care. DevOps reports a bug in your production code so you dig into it on your local machine (OS X) and fix the issue. You push the code to your test environment and it runs perfectly.

However, the QA team reports that the bug still exists and reassigns you the ticket. Perplexed, you spend the rest of the day checking and double-checking your work. You profess to the QA team that the bug is fixed but they insist that it still exists. Now you are forced to jump on a Hangout and discuss the issue in depth. After an hour or so you realize that it is a hardware/version issue as the QA team is testing on a Windows box with a different version of Java and Tomcat than what you are using. Ahhh!!! The madness!!

This is one of the problems that Docker is trying to solve through “containerization”. In a nutshell, “Docker is an open source engine that enables any application to be deployed as a lightweight, portable, self-sufficient container that will run virtually anywhere. Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above.”

I hear what you’re asking yourself, “Isn’t this just another VM”? It’s a similar concept only better. While VM’s are resource heavy, bulky and hard to store and move, containers are a lightweight, efficient and flexible approach to virtualization. Containers have less overhead, a lower footprint and boot faster than conventional VMs. Unlike traditional virtualization, containerization takes place at the kernel level and not the OS. For more detail, check out the full story.

I ran into the Docker guys at the Monktoberfest conference last fall and they have a crazy amount of love from the developer community. Over the past 9 months since its release, the Docker open source project has been on a tear:

  • 1,250+ forks and 8,700+ GitHub stars
  • 275+ contributors (over 90% are not Docker employees)
  • 15,000+ developers have completed Docker’s online training
  • 150,000+ containers downloaded
  • Thousands of containerized applications on the Docker public registry

Much like AMIs, there is a directory of reusable community submitted Docker containers. So if you need a container with Node.js 0.10.21, MongoDb 2.4.6, grunt and bower, simply use git-like commands to pull down the container and fire it up. You can also build your own Dockerfiles to automate and script your image creation needs.

So now you simply have to worry about writing your application and deploying it to a Docker instance running where ever it may be. Since Docker is essentially a developer-friendly abstraction layer on top of Linux containers (LXC), it’s capable of running multiple isolated Linux systems (containers) on a single control host!

Previous Article
Table Alignment in Google Docs
Table Alignment in Google Docs

By Olya Schaefer Table alignment in Google Docs has gotten a lot easier! If you have been a long time Googl...

Next Article
Force.com CLI Fun with JSON and .jq
Force.com CLI Fun with JSON and .jq

Most of us at Appirio are terminal junkies so we were really excited when the Force.com CLI was announced. ...