compare","metadata":{}}]}}]},"metadata":{"auth":{},"testAttributes":{}},"context":{"page":{"locale":null,"site":null,"pageUrl":"https://aws.amazon.com/compare/the-difference-between-docker-vm/","targetName":null,"pageSlotId":null,"organizationId":null,"availableLocales":null},"environment":{"stage":"prod","region":"us-east-1"},"sdkVersion":"1.0.115"},"refMap":{"manifest.js":"289765ed09","what-is-header.js":"251923df8a","what-is-header.rtl.css":"ccf4035484","what-is-header.css":"ce47058367","what-is-header.css.js":"004a4704e8","what-is-header.rtl.css.js":"f687973e4f"},"settings":{"templateMappings":{"category":"category","headline":"headline","primaryCTA":"primaryCTA","primaryCTAText":"primaryCTAText","primaryBreadcrumbText":"primaryBreadcrumbText","primaryBreadcrumbURL":"primaryBreadcrumbURL"}}}

What’s the Difference Between Docker and a VM?


whats-the-difference-between-docker-and-a-vm","metadata":{}}]}},{"fields":{"faqQuestion":"Virtualization: Docker vs. virtual machine ","faqAnswer":"

Virtualization allows the creation of a virtual instance of real-life resources, such as servers and networks. In computing, virtualization allows multiple isolated instances of a virtualized component to operate on the real-life component. \n

For example, multiple virtual servers could run on a physical server. By sharing real-life resources among multiple virtual instances, they’re better utilized and more cost-effective to run. Virtualization is the basis of a significant amount of application development and deployment. \n

Virtual machines \n

As the name suggests, virtual machines (VMs) provide virtualization of an entire machine (server). A virtual machine emulates the hardware components of a physical machine, such as the CPU, memory, network interface card, USB controllers, and sound cards. You can run a guest operating system and multiple applications in the virtual environment.  \n

Virtual machines have made cloud technologies possible, and in Amazon Web Services (AWS), a virtual machine is called an instance. These cloud instances are owned and maintained by AWS and usable via APIs. \n

Read about cloud instances » \n

Docker \n

A VM lets you run a virtual machine on any hardware. Docker lets you run an application on any operating system. It uses isolated user-space instances known as containers. \n

Docker containers have their own file system, dependency structure, processes, and network capabilities. The application has everything it requires inside the container and can run anywhere. Docker container technology uses the underlying host operating system kernel resources directly. ","id":"seo-faq-pairs#virtualization-docker-vs-virtual-machine","customSort":"2"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#whats-the-difference-between-docker-and-a-vm","name":"whats-the-difference-between-docker-and-a-vm","namespaceId":"seo-faq-pairs#faq-collections","description":"

whats-the-difference-between-docker-and-a-vm","metadata":{}}]}},{"fields":{"faqQuestion":"What are the other similarities between Docker and virtual machines?","faqAnswer":"

As virtualization technologies, Docker and virtual machines (VMs) have certain similarities. \n

Images \n

Docker containers and virtual machines are both created from images. Each image serves as a blueprint of the virtualized environment. Images allow users to create and share consistent environments without having to configure them each time. \n

An image specifies all the necessary system resources to run applications. For example, a VM image creates operating system backups while the Docker container image creates an application environment backup. \n

Versioning \n

Both Docker container images and virtual machine images can be versioned to track environment configuration changes over time. \n

Versioning in Docker refers to the ability to track and manage changes to Docker images over time. It allows developers to keep track of different versions of their applications, roll back to previous versions if necessary, and deploy different versions of an application simultaneously.  \n

Similarly, versioning in virtual machines refers to the process of tracking and managing changes to the virtual machine image over time. Virtual machine versioning keeps track of changes—such as updates and patches—to the virtual hardware or operating system configuration. \n

Portability \n

Both virtual machines and Docker were designed to address the difficulties of having to develop different application configurations for different types of underlying architectures. Although they take different approaches to the challenges, both Docker and VM images are highly portable across architectures, whether on premises or in the cloud. ","id":"seo-faq-pairs#what-are-the-other-similarities-between-docker-and-virtual-machines","customSort":"3"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#whats-the-difference-between-docker-and-a-vm","name":"whats-the-difference-between-docker-and-a-vm","namespaceId":"seo-faq-pairs#faq-collections","description":"

whats-the-difference-between-docker-and-a-vm","metadata":{}}]}},{"fields":{"faqQuestion":"Key differences: Docker vs. virtual machine","faqAnswer":"

Both virtual machines (VMs) and Docker address the challenge of running applications across different environments. But they do so for slightly different reasons and with different approaches. \n

Objective \n

Virtual machines were originally designed to allow multiple operating systems to run on a single physical machine. The objective is to allow users to create a virtual environment that’s isolated from the underlying hardware. VMs abstract hardware details to make it easier to run applications on different hardware architectures and use hardware resources more efficiently. \n

Docker, on the other hand, was designed to provide a lightweight and portable way to package and run applications in an isolated and reproducible environment. Docker abstracts operating system details to address the challenge of deploying applications across different environments, such as development, testing, and production. It can be very challenging to manage software environment updates and maintain environment consistency everywhere. This is especially true for organizations that run hundreds of applications or decompose applications into hundreds of microservices. Docker addresses this problem through containerization.  \n

End product \n

Docker is the name of the open-source container platform that’s owned and operated by the company Docker. There are alternative platforms like Podman, although they’re far less popular; Docker is synonymous with containerization. The container is the artifact, the usable part for the end user. \n

A virtual machine itself is the usable part for the end user. The technology isn’t associated with a specific brand. You can deploy VMs in on-premises data centers or access them via APIs as a managed cloud service. \n

Architecture \n

A virtual machine runs its own kernel and host operating system, along with applications and their dependencies like libraries and other binary files. A hypervisor coordinates between the hardware (host machine or server) and the virtual machine. It allocates the physical hardware resources outlined during instantiation to the virtual machine for its exclusive use. Multiple virtual machines can exist on a single powerful server, managed by a single hypervisor, with hundreds of applications running on each virtual machine. \n

A Docker container contains only its dependencies. The software Docker Engine powers virtualization in Docker. It provides coordination between running containers and the underlying operating system, whether it’s a physical or virtual machine. \n

For more advanced virtualization management with Docker, use Kubernetes. For more information, read What's the Difference Between Kubernetes And Docker? \n

Resource sharing \n

Both virtual machines and Docker containers use resource multiplexing, or resource sharing between virtualized instances. \n

Virtual machines request a specific amount of the resource up-front from the hardware and continue to steadily occupy that amount, so long as the virtual machine is running.  \n

Docker containers, on the other hand, use resources on demand. Rather than asking for a specific amount of physical hardware resourcing as virtual machines do, they simply request what they need from the single operating system kernel. Multiple containers share the same operating system. Docker containers direct resource sharing with the kernel leads and may use less system resources compared to a VM.  \n

Security \n

Because Docker containers share the kernel with the host operating system, for lightweight resource consumption, they’re at risk if there are vulnerabilities in the kernel. However, Docker also provides many advanced security controls. \n

Conversely, as a VM runs an entire operating system, there’s an added level of isolation when running applications. VMs offer higher security as long as the operating system has strict security measures in place.","id":"seo-faq-pairs#key-differences-docker-vs-virtual-machine","customSort":"4"},"metadata":{"tags":[{"id":"seo-faq-pairs#faq-collections#whats-the-difference-between-docker-and-a-vm","name":"whats-the-difference-between-docker-and-a-vm","namespaceId":"seo-faq-pairs#faq-collections","description":"

whats-the-difference-between-docker-and-a-vm","metadata":{}}]}},{"fields":{"faqQuestion":"When to use: Docker vs virtual machine","faqAnswer":"

Docker containers run on Linux architecture and require Linux kernel-specific features like namespaces and control groups (cgroups). Developers often run the Docker platform on Linux-based virtual machines. Docker packages application code into containers that run anywhere. Environment updates are done only once in the container. You don’t have to update your application environment.  \n

For example, you can spin up an instance in AWS and immediately load it with an Amazon Machine Image (AMI) that comes preconfigured with Docker.  \n

 \"\" \n

However, if you’re deciding specifically whether to use either a virtual machine (VM) or Docker to deploy applications, it depends on the application’s running requirements. \n

When to use a virtual machine \n

It’s best to use a virtual machine if you’re running applications with these requirements:  \n