docker容器和虚拟机的共同点在于,都可以在宿主机上提供 虚拟化 环境,各个虚拟环境是相互隔离的
The same between docker and virtual machine is they both can provide isolated environment
它们的主要区别在于
虚拟机是base在硬件层上的,也就是硬件级别的虚拟化,虚拟机有独立的虚拟硬件,独立的虚拟bios,独立的虚拟驱动
而docker base在rootfs层上的
At the bottom of the Linux system is the system kernel, and a typical Linux boot requires two File systems
- bootfs
- rootfs
Bootfs (boot file system) mainly contains bootloader and kernel. bootloader mainly boots the kernel. bootfs are umount after boot is successful and the kernel is loaded into memory
rootfs (root file system) 包含的就是典型 Linux 系统中的 /dev, /proc, /bin, /etc 等标准目录和文件。
So bootfs are basically the same for different Linux distributions, and rootfs are different, so different distributions can share bootfs
If your application requires a specific system kernel, such as Linux Kernel 2.6 only, then the docker is not appropriate for this application and you should choose a virtual machine scenario
Most applications are not kernel dependent