
上QQ阅读APP看书,第一时间看更新
Why containers are revolutionary
The brief and successful history of containers speaks for itself, which leads to the question, why are containers so popular? The following provides some of the more important answers to this question:
- Lightweight: Containers are often compared to virtual machines, and in this context, containers are much more lightweight that virtual machines. A container can start up an isolated and secure runtime environment for your application in seconds, compared with the handful of minutes a typical virtual machine takes to start. Container images are also much smaller than their virtual machine counterparts.
- Speed: Containers are fast – they can be downloaded and started within seconds, and within a few minutes you can test, build, and publish your Docker image for immediate download. This allows organizations to innovate faster, which is critical in today's ever increasing competitive landscape.
- Portable: Docker makes it easier than ever to run your applications on your local machine, in your data center, and in the public cloud. Because Docker packages are complete runtime environments for your application complete with operating system dependencies and third-party packages, your container hosts don't required any special prior setup or configuration specific to each individual application – all of these specific dependencies and requirements are self-contained within the Docker image, making comments like "But it worked on my machine!" relics of the past.
- Security: There has been a lot of debate about the security of containers, but in my opinion, if implemented correctly, containers actually offer greater security than non-container alternative approaches. The main reason for this is that containers express security context very well – applying security controls at the container level typically represents the right level of context for those controls. A lot of these security controls are provided by "default" – for example, namespaces are inherently a security mechanism in that they provide isolation. A more explicit example is that they can apply SELinux or AppArmor profiles on a per container basis, making it very easy to define different profiles depending on specific security requirements of each container.
- Automation: Organizations are adopting software delivery practices such as continuous delivery, where automation is a fundamental requirement. Docker natively supports automation – at its core, a Dockerfile is an automation specification of sorts that allows the Docker client to automatically build your containers, and other Docker tools such as Docker Compose allow you express connected multi-container environments that you can automatically create and tear down in seconds.