Home  >  Article  >  Operation and Maintenance  >  Can docker be installed on a virtual machine?

Can docker be installed on a virtual machine?

WBOY
WBOYOriginal
2022-01-17 11:15:216317browse

Docker can be installed on a virtual machine; docker containers can run on virtual machines or physical machines. Whether it is a virtual machine or a physical machine, it is a delivery method of hardware and infrastructure, and docker containers mainly It is to solve a series of software-centric problems and it is feasible to run containers in virtual machines.

Can docker be installed on a virtual machine?

The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.

Can docker be installed on a virtual machine?

The docker container can be run on a virtual machine or a physical machine. Strictly speaking, containers and virtual machines are not on the same level. They are a packaged collection of software environments.

Whether it is a virtual machine or a physical machine, it is a delivery method of hardware/infrastructure, which is essentially a level; and containers mainly solve a series of software-centered problems (development, testing, Deploy, publish, run).

Running containers in virtual machines has become a common practice. For example, AWS's container service only runs in virtual machines.

About container docker and virtualization technology

The Docker daemon can communicate directly with the main operating system to allocate resources to each Docker container; it can also connect the container with The main operating system is isolated and individual containers are isolated from each other. Docker is often used to isolate different applications, such as front-end, back-end, and database.

Docker has the characteristics of compactness, fast migration and deployment, and efficient operation, but its isolation is worse than server virtualization: different containers belong to different waybills (different application instances run on Docker) and are independent of each other (isolation) . But it is managed by the same warehouse manager (host operating system kernel), so the warehouse manager can see the relevant information of all containers (because the operating system kernel is shared, relevant information will be shared).

Virtual machines are better at completely isolating the entire operating environment. For example, cloud service providers usually use virtual machine technology to isolate different users. A virtual machine takes minutes to start, while a Docker container can start in milliseconds. Without a bloated operating system, Docker can save a lot of disk space and other system resources.

Server virtualization is like establishing multiple independent "small docks" - warehouses (virtual machines) on the dock (physical host and virtualization layer). It has a completely independent (isolated) space and belongs to different customers (virtual machine owners). Each warehouse has its own warehouse manager (the operating system kernel of the current virtual machine) and cannot manage other warehouses. There is no sharing of information.

Therefore, we need to adopt different methods according to different application scenarios and needs, using Docker technology or using server virtualization technology.

Install docker on a linux virtual machine

Steps:

1. Check the kernel version, it must be 3.10 or above

uname -r

2. Install docker

yum install docker

3. Enter y to confirm the installation

4. Start docker

[root@localhost ~]# systemctl start docker

[root@localhost ~]# docker -v

Docker version 1.12.6, build 3e8e77d/1.12.6

5. Start docker

[root@localhost ~]# systemctl enable docker

Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to / usr/lib/systemd/system/docker.service.

6. Stop docker

systemctl stop docker

Recommended study: "docker video tutorial

The above is the detailed content of Can docker be installed on a virtual machine?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn