Docker containers can be a true productivity booster for your next web apps. Many people call it hotter than hot. Why?
In this article I’d like to take a look at the Docker containers and show you some real-world problems it is solving for web developers. And hopefully you will understand the true essence of it.
What is Docker?
Docker is an open source tool for running isolated containers on Linux making the deployment of apps inside containers faster. It creates portable, self-sufficient containers from any application.
The same container that the developer builds and tests on his PC can run in production, on VMs, in the cloud and a lot more places.
You can run a single service per container, e.g. one container for your MySQL, one container for your Apache, and one container for your WordPress installation.
Otherwise, you can put a whole application stack in one container as well. There’s no right or wrong about this.
Containers vs. VMs
The ability to separate an application from the underlying Linux operating system is very attractive. Comparing Docker containers to VMs is a valid thing, although containers do not replace VMs. Virtual machines basically have a full operating system with its own memory management, device drivers, etc. In contrast, Docker containers share the host’s OS and are therefore much easier to manage.
Container & Container-as-a-Service
Containers have been around for quite a while. Although it never really became something like an “industry standard”, Docker made it all possible. With a wide range of support and easy-to-learn and -use containers, Docker is here to stay.
Docker is built on top of LXC (Linux Containers). It’s definitely not a replacement for LXC, instead, it offers some high-level features on top of LXC, such as versioning and offers portable deployment across machines. I’d like to recommend this StackOverflow thread.
The growth of the Container-as-a-Service business is immense. At the beginning of 2015, Docker published an infographic displaying the growth of container downloads, the number of applications bound up in Docker containers and some other metrics.
(the entire infographic can be found here: http://venturebeat.com/wp-content/uploads/2015/01/Docker_Infographic_FINAL.jpg)
Docker use cases for web developers
Docker is designed in a way that it can be used in many different use cases. Besides the mentioned use cases on docker.com, I’d like to take a look at the following use cases where the technology of Docker provides a great, consistent environment.
Big community around Docker
The great thing about Docker is its ready-to-go containers. With its growing community of developers, there are thousands of ready-to-go containers for popular applications like MySQL or WordPress.
If you want to run WordPress for example, you can download it from the Docker Hub and run it with this single line of code:
docker run --name some-wordpress --link some-mysql:mysql -d wordpress
Big win for local development
As a web developer, you might be developing on your local engine. Minimizing the differences between your local environment and production help us to avoid last minute changes because of configuration differences.
Working with Docker containers on local environment is a true productivity booster and saves you some last minute hassle.
We’ve seen some fantastic journey in the last decades. From real hardware to virtual servers to Docker. Setting up new hardware resources probably took a couple of days. With virtualization, it went down to just a couple of minutes.
With Docker, you can have everything up-and-running within seconds. By simply creating a container and not booting up an OS, we definitely see some time saved.
App isolation for safe sandboxing
With Docker, you run one application or process per container. Containers take advantage of the ability to create isolated environments. Each container is assigned its own runtime environment and every single container receives its own network stack and process space.
If you want to install different versions of python or any other library, containers are your solution. You can simply install a library in a container, compare it with a different library version from another container, play around with it and throw it away without any risk.
Security benefits of Containers
Running various containers can provide some security benefits. By running applications on various containers, each container only has access to the ports and files explicitly exposed by the other container.
Further on, containers offer a higher level of control on what data and software are installed. Some malodorous script run in one container, won’t affect any other container.
Updates are an important security issue. Running applications in a Docker environment makes the process of updating less painful.
Setting up testing environments with Docker containers is super-easy. Thinking about all those different frameworks and databases, as well as different versions of Python, for example, testing in a virtualized environment has become a true challenge.
By setting up different containers for testing, you can dramatically speed up your test suite by separating different versions in different containers.
One of the many reasons for its increasing usage of Docker containers is definitely the simple and easy-to-setup configuration. With VMs, it’s possible to run any application with its own configuration on top of your infrastructure. Docker basically provides the same capability without the overhead of a VM. However, Docker containers cannot replace virtual machines. This lets you decouple the infrastructure requirements from the application environment.
Dockerize your web development?
Containerizing your applications will not only make your deployment faster but also a lot easier. The gained portability and flexibility with containers is immense. As a web developer, you can supercharge your development environment using Docker.
Prefer a quick summary? No worries, we got you covered.
If you found this post interesting, follow us on twitter where we tweet about web development, web design, and startups.
Capture feedback easily. Get more insights and confidence.
Getting feedback has never been easier and we hope you’ve realized that after reading this article. Let us know what you think, your feedback is important.