{"id":342686,"date":"2021-09-22T15:00:00","date_gmt":"2021-09-22T12:00:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/whats-the-difference-between-docker-and-a-virtual-machine-vm-cloudsavvy-it\/"},"modified":"2021-09-22T15:00:00","modified_gmt":"2021-09-22T12:00:00","slug":"whats-the-difference-between-docker-and-a-virtual-machine-vm-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/whats-the-difference-between-docker-and-a-virtual-machine-vm-cloudsavvy-it\/","title":{"rendered":"#What\u2019s the Difference Between Docker and a Virtual Machine (VM)? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2df73654a5e\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2df73654a5e\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-the-difference-between-docker-and-a-virtual-machine-vm-cloudsavvy-it\/#What_Makes_Docker_So_Useful\" >What Makes Docker So Useful?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/whats-the-difference-between-docker-and-a-virtual-machine-vm-cloudsavvy-it\/#Downsides_of_Docker\" >Downsides of Docker<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What\u2019s the Difference Between Docker and a Virtual Machine (VM)? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage imgchk9 alignnone wp-image-503 size-full\" srcset=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/06\/c454d054.png?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/06\/c454d054.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/06\/c454d054.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Docker logo\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Docker containers provide a similar service to virtual machines, providing an isolated environment for <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications to run in, but they\u2019re fundamentally two different technologies. We\u2019ll discuss the differences, and what makes Docker so useful.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"What_Makes_Docker_So_Useful\"><\/span>What Makes Docker So Useful?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The main purpose of a virtual machine is to partition a large server into smaller chunks. The important part is that it isolates processes running on each VM. For example, your hosting provider could have a 32 core machine, and split it into eight 4 core VMs that it sells to different customers. This reduces costs for everyone, and they\u2019re great if you\u2019re running a lot of processes or need full SSH access to the underlying hardware.<\/p>\n<p>However, if you\u2019re just running one app, you might be using more resources than necessary. In order to run that single app, the hypervisor has to spin up an entire guest operating system, which means that 32 core machine is running eight copies of Ubuntu. On top of that, you have virtual machine overhead for each instance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"imgchk9 alignnone wp-image-492 size-full\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/06\/bc4f8762.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Docker containers offer isolation without the overhead of virtual machines\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Docker presents a better solution. Docker containers offer isolation without the overhead of virtual machines. Each container runs in its own environment, sectioned off with Linux namespaces, but the important part is that the code in the containers runs directly on the machine. There\u2019s no emulation or virtualization involved.<\/p>\n<p>There\u2019s still a bit of overhead due to networking and interfacing with the host system, but applications in Docker <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">general<\/a>ly run close to bare-metal speeds, and certainly much faster than your average VPS. You don\u2019t have to run 8 copies of Ubuntu, only one, which makes it cheap to run multiple Docker containers on one host. Services like AWS\u2019s Elastic Container Service and GCP\u2019s <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/cloud.google.com\/run\">Cloud Run<\/a>\u00a0provide ways to run individual containers without provisioning an underlying server.<\/p>\n<p>Containers package up all of the dependencies your app needs to run, including libraries and binaries that the OS uses. You can run a CentOS container on an Ubuntu server; they both use the Linux kernel, and the only difference is the included binaries and libraries for the OS.<\/p>\n<p>The main difference with Docker containers is that you generally won\u2019t have SSH access to the container. However, you don\u2019t exactly need it\u2014the configuration is all handled by the container file itself, and if you want to make updates, you\u2019ll need to push a new version of the container.<\/p>\n<p>Because this configuration all happens in code, it allows you to use version control like Git for your server software. Because your container is a single image, it makes it easy to track different builds of your container. With Docker, your development environment will be exactly the same as your production environment, and also the same as everyone else\u2019s development environment, alleviating the problem of \u201cit\u2019s broken on my machine!\u201d<\/p>\n<p>If you wanted to add another server to your cluster, you wouldn\u2019t have to worry about reconfiguring that server and reinstalling all the dependencies you need. Once you build a container, you can easily spin up a hundred instances of that container, without much configuration involved. This also enables very easy Auto Scaling, which can save you a lot of money.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Downsides_of_Docker\"><\/span>Downsides of Docker<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Of course, Docker isn\u2019t replacing virtual machines anytime soon. They\u2019re two different technologies, and virtual machines still have plenty of upsides.<\/p>\n<p>Networking is generally more involved. On a virtual machine, you usually have dedicated network hardware exposed directly to you. You can easily configure firewalls, set applications to listen on certain ports, and run complicated workloads like load balancing with HAProxy. On Docker, because all the containers run on the same host, this is often a bit more complicated. Usually though, container-specific services like AWS\u2019s Elastic Container Service and GCP\u2019s Cloud Run will provide this networking as part of their service.<\/p>\n<p>Performance on non-native operating systems is still on-par with virtual machines. You can\u2019t run a Linux container on a Windows host machine, so Docker for Windows actually uses a Windows Subsystem for Linux VM to handle running containers. Docker essentially provides a layer of abstraction on top of the virtual machine in this case.<\/p>\n<p>Persistent data is also a bit complicated. Docker containers are designed to be stateless. This can be fixed with volume mounts, which mount a directory on the host to the container, and services like ECS allow you to mount shared volumes. However, it doesn\u2019t beat storing data on a regular server, and you wouldn\u2019t really want to try and run a production database in Docker.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/5245\/whats-the-difference-between-docker-and-a-virtual-machine-vm\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What\u2019s the Difference Between Docker and a Virtual Machine (VM)? \u2013 CloudSavvy IT&#8221; Docker containers provide a similar service to virtual machines, providing an isolated environment for applications to run in, but they\u2019re fundamentally two different technologies. We\u2019ll discuss the differences, and what makes Docker so useful. What Makes Docker So Useful? The main purpose&#8230;<\/p>\n","protected":false},"author":1,"featured_media":342687,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/06\/c454d054.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-342686","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/342686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=342686"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/342686\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/342687"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=342686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=342686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=342686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}