Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
One of the frequent questions asked about Docker is how it differs from VM (virtual machine).
A virtual machine is a system which acts exactly like a computer.
In simple terms, it makes it possible to run what appears to be on many separate computers on hardware, that is one computer. Each virtual machine requires its underlying operating system, and then the hardware is virtualized.
The operating system support of Virtual machine and Docker container is very different. From the image above, you can see each virtual machine has its guest operating system above the host operating system, which makes virtual machines heavy. While on the other hand, Docker containers share the host operating system, and that is why they are lightweight.
Sharing the host operating system between the containers make them very light and helps them to boot up in just a few seconds. Hence, the overhead to manage the container system is very low compared to that of virtual machines.
The docker containers are suited for situations where you want to run multiple applications over a single operating system kernel. But if you have applications or servers that need to run on different operating system flavors, then virtual machines are required.
Below table explains briefly a virtual machine and Docker container differences.
Virtual Machine | Docker Container |
Isolation is at Hardware-level process | OS level process isolation |
Each VM has a separate OS | Each container can share OS |
Boots in minutes | Boots in seconds |
VMs are of few GBs | Containers are lightweight (KBs/MBs) |
Ready-made VMs are difficult to find | Pre-built docker containers are easily available |
VMs can move to new host easily | Containers are destroyed and re-created rather than moving |
Creating VM takes a relatively longer time | Containers can be created in seconds |
More resource usage | Less resource usage |
Docker Commands & CLI
After installation ( you can find details in docker official web site ) of docker engine, you can test that docker is working by executing below code on terminal/command line:
$ docker run docker/whalesay cowsay Hello-World!
Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.