When should Docker be used?
Docker is not a replacement for virtual machines, but rather a way for you to use containers and host your larger web applications closer to their users. Docker’s greatest advantage is that it can help you scale out your applications, which means more instances running at any given time. It also provides isolation between containers so that they don’t step on each other.
Docker – Deploying WebApps on Docker
Docker applies abstraction at the software layer of the operating system to create an instant and portable environment that includes everything you need: a Linux kernel, libraries, system tools like grep or sshfs, plus applications (web servers/services) and all dependencies needed by those applications (e.g., database engines). When deployed, these containers are all bundled up and run in a single, isolated process. The benefits stem from using containers rather than virtual machines and enabling you to run the exact same application production environment on different servers without modifying it (or without having to purchase servers for every deployment).
Using the right tools ensures that you are going to be delivering a great user experience, and if you want that experience to be easier and more consistent across all your environments, you should consider Docker. The developer community has been successful in growing open-source tools and frameworks in many industries because they allow companies to rapidly iterate on their products without having to go through expensive tooling investments. The environments Docker creates are not the same as virtual machines, but the benefits you will see when you use them should outweigh these costs.
- Containerization vs Virtualization: Docker uses “containers” for its containers. Containers are basically a mechanism for labeling resources with a namespace. For example, an application’s database and all of its files would be stored under a container’s file system namespace. What this means is that Docker makes it easier to deploy your applications on any machine. Docker also provides isolation between containers and makes life easier for deployment automation tooling by providing a safe, consistent environment to run in (the Docker daemon creates this environment automatically).
- Single Process Containers versus Multiple Process Containers: Docker is not a single-process containerization framework. It does not automatically create processes for each of your applications. Instead, it creates a container for each running application and allows you to manage a process tree. Applications can still be written as multiple processes, and Docker will intelligently link them together (in the same way that multiple processes are linked together under the same application).
- Built by Docker, Not for Stopping Docker: Docker currently does not have great integration with other environments or systems like Google App Engine or Heroku. Docker is focused on the developer, and it is important to think about how your application will be run. Do you want to run your app in a secure, robust environment? If so, Docker is not for you.
- No support for lots of containers: Docker currently has only limited support for scaling and auto-scaling containers across multiple hosts. Additionally, Docker does not do any type of load balancing or failover. These are important features in production environments because they allow you to scale out as needed without having to manually rebuild all of your containers (failure and availability). Support for this kind of orchestration will come with time, though.