Many years ago, what we do when we want to deploy and run our application after development? Typically we will setup physical machine, this normally including but not limited to system tools, jdk, python, database, application server etc..etc.. then deploy and run.
If we have multiple environment to deploy and run, then we repeat the same step for all environment, eg: dev, qa, staging, production.
After few years, people tend to make their life easier by not setup, deploy and run the application directly on physical machine, but using virtual machine where they can easily clone it for other environment (figure 1 show architecture of virtual machine).
figure 1
image from: www.docker.com
When more and more application run with different runtime environment, framework version, database vendor, server etc… Of cause deploying and running on top of virtual machine still works fine, but virtual machine is an operating system imitates dedicated hardware, meaning it shared host hardware system’s resources, which will then no longer available to the hosted applications.
Emerged of Docker container in perfect timing is good fit for this. It is a process that talks directly to the Linux kernel. And run as isolated process in host operating system. Meaning, we can now deploy our application in smaller container instead of virtual machine. (figure 2 show architecture of Docker).
figure 2
image from: www.docker.com
If you still confuse Docker is just another type of virtual machine, figure 3 might clear your doubts.
p/s: Docker looks promising and it is really a good match for microservices, nevertheless, it has some security concern as they are sharing same kernel with host.
Container and virtual machine have different strength, hence should not viewed as competitors, but complimentary.
Source:
Docker documentation
Self-pace video tutorial
Virtualization vs. Containers: What You Need to Know