Docker for Developer Happiness

So, everybody is talking Docker these days. It is being positioned as one of the important tools for effecting DevOps transformation in engineering organizations. Docker was founded around 2010 and has been growing in popularity ever since.

In essence, Docker is a service that will let developers build containers for hosting software applications along with their dependencies and thereby enabling more seamless deployments of such applications. It has several real world use cases such as painless software deployments, managing distributed software applications and immutable DevOps environments. The intent of this post is intended to dive into Docker and understand how it can be leveraged to make a developer’s life easier. There are a number of ways in which individual developers or teams can leverage the power of Docker to enable some of their day to day functions.

Need one development environment, shaken not stirred!

Irrespective of the kind of technology or platform, A significant aspect of a developer’s toolchain is his or her local development environment. It encompasses the tools needed that enable the developer’s efforts to build software. Examples of such tools would be the database, a caching service, an indexing tool for search, etc. Creating a docker container that would encapsulate different services like these is an immutable way of managing the development environment that a developer needs. It also becomes easy to share a container like this with other members of the team. Let’s say one of these members had a corrupt database or broken service in their container, it’s almost a no brainer from them to work their way out of something like that. Instead of troubleshooting the issue and potentially going down a rabbit hole, they have the choice of throwing the broken container away and recreating it with a single command.

I don’t hate Integration Testing any more!

Another big need that software developers have these days is to write and execute integration tests for their software. This means running tests that can validate the end to end correctness of the software they have built. Such tests usually involve hitting a multitude of dependencies that the software relies on. Assembling all these dependencies and wiring them up for the tests could be quite an effort. Docker of course, can make this painless using its containerization approach. Build a container that will assemble all the different dependencies together and set them up to support the integration tests. Spinning up such a container becomes an effortless task in the process of executing the tests.

On-boarding new developers is going to be easier!

As a new developer on the team learning the ropes, there are usually a gazillion things to absorb and internalize. Docker could be used as an effective tool to help make this easier in a couple of ways. First, it can be used to script and automate the setting up of the new developer’s machine or development environment using the container approach described earlier. Second, it can be used to execute predetermined tasks on the developer’s machine such as setting up data in their database, etc. The automation helps newbies waste less time yak shaving. They can get to the more important things like learning the domain or understanding how the application works rather than focusing their energy on environment set up, configuration, etc.

This is a simple docker container I created for the purposes of this blog post: https://hub.docker.com/r/kswamin1980/demo/. The container will let you run a simple Ruby application that pulls tweets from a Twitter account. Running this container involves just two easy steps:

docker pull kswamin1980/demo – pulls the container from the docker hub registry.
docker run kswamin1980/demo – executes the container and in turn the Ruby application that is contained within it.

The repository for this container along with the Dockerfile can be found here: https://github.com/kmuthupa/docker-demo.

In a world of increasing DevOps influence, a tool like docker can be critical to the success of an agile engineering organization.