Docker与虚拟机

4xrmg8kj  于 2022-12-11  发布在  Docker
关注(0)|答案(2)|浏览(214)

我看过一些关于dockers和虚拟机的文档。我猜我们的环境像dev、prod运行在一个服务器的虚拟机上。它们都运行在不同的虚拟机上,但是都是一台计算机(服务器)。而且,每个虚拟机都包含dockers。每个dockers都包含container。在这个container中,保存着应用程序映像文件。例如;在虚拟机B中,容器B包含了应用程序映像,对吗?
一个Docker可以包含很多容器吗?为什么我们需要在一个Docker中有很多容器?有人能解释一下Docker,虚拟机,环境和映像文件吗?这些环境是如何运行服务器的?

vshtjzan

vshtjzan1#

https://www.docker.com/what-container开始:容器映像是一个轻量级的、独立的、可执行的软件包,其中包括运行它所需的一切。
Docker是在一台机器(节点)上运行多个容器的服务,该机器可以是虚拟机或物理机。
虚拟机是一个完整的操作系统(通常不是轻量级的)。
如果您有多个应用程序,并且这些应用程序需要彼此冲突的不同配置,则可以使用Docker容器将它们部署在不同的计算机上,也可以部署在同一台计算机上,因为容器彼此是隔离的。
因此,简而言之,容器可以使您的应用程序部署和管理更加容易。

ltskdhd1

ltskdhd12#

What is Docker?

Organizations in today’s world look forward to transforming their business digitally but are constrained by the diverse portfolio of applications, cloud, and on-premises-based infrastructure. Docker solves this obstacle of every organization with a container platform that brings traditional applications and microservices built on Windows, Linux, and mainframe into an automated and secure supply chain.Docker is a software development tool and a virtualization technology that makes it easy to develop, deploy, and manage applications by using containers. A container refers to a lightweight, stand-alone, executable package of a piece of software that contains all the libraries, configuration files, dependencies, and other necessary parts to operate the application.
In other words, applications run the same irrespective of where they are and what machine they are running on because the container provides the environment throughout the software development life cycle of the application. Since containers are isolated, they provide security, thus allowing multiple containers to run simultaneously on the given host. Also, containers are lightweight because they do not require an extra load of a hypervisor. A hypervisor is a guest operating system like VMWare or VirtualBox, but instead, containers run directly within the host’s machine kernel.
Containers provide the following benefits:

  • Reduced IT management resources
  • Reduced size of snapshots
  • Quicker spinning up apps
  • Reduced and simplified security updates
  • Less code to transfer, migrate and upload workloads
    What is a Virtual Machine?

A Virtual Machine (VM), on the other hand, is created to perform tasks that if otherwise performed directly on the host environment, may prove to be risky. VMs are isolated from the rest of the system; the software inside the virtual machine cannot tamper with the host computer. Therefore, implementing tasks such as accessing virus-infected data and testing of operating systems are done using virtual machines.
We can define a virtual machine as: A virtual machine is a computer file or software usually termed as a guest, or an image that is created within a computing environment called the host.
A virtual machine is capable of performing tasks such as running applications and programs like a separate computer making them ideal for testing other operating systems like beta releases, creating operating system backups, and running software and applications. A host can have several virtual machines running at a specific time. Logfile, NVRAM setting file, virtual disk file, and configuration file are some of the key files that make up a virtual machine. Another sector where VMs are of great use is server virtualization. In server virtualization, a physical server is divided into multiple isolated and unique servers, thereby allowing each server to run its operating system independently. Each virtual machine provides its virtual hardware, such as CPUs, memory, network interfaces, hard drives, and other devices.
VMs are broadly divided into two categories depending upon their use:

  • System Virtual Machines: A platform that allows multiple VMs, each running with its copy of the operating system to share the physical resources of the host system. Hypervisor, which is also a software layer, provides the virtualization technique. The hypervisor executes at the top of the operating system or the hardware alone.
  • Process Virtual Machine: Provides a platform-independent programming environment. The process virtual machine is designed to hide the information of the underlying hardware and operating system and allows the program to execute in the same manner on every given platform.

Source: Cloud Academy

相关问题