谁可以简单介绍一下docker到底是干什么用的?
PHP中文网
PHP中文网 2017-04-25 09:03:25
0
5
1061

在百度百科上看了一阵,专业术语太多,我还是没有真正搞懂。谁可以简单解释一下,比如它到底解决了什么问题?
刚才看了几位大神的回答,可能是我接触太少吧,感觉仍然不是非常清楚。是不是它相当于一个虚拟机,你把软件部署到那个虚拟机上面?性能不是差了很多吗?如果说它利用的还是宿主机器的资源,那么这跟直接运行在宿主机器就没有区别?如果宿主机器缺少它的依赖库,它依然运行不起来。

PHP中文网
PHP中文网

认证0级讲师

reply all(5)
Peter_Zhu

docker has two main core contributions and its impact on software delivery:
Two major contributions:
1. Encapsulation, which encapsulates the running environment and code into a box
2. Mirror warehouse, which converts images into Distributed in a way similar to a code warehouse

The impact of software delivery: As a "container" in the IT industry, it has changed the entire software delivery process and method. It is equivalent to changing the entire shipping, air transportation, and land transportation methods like containers, allowing producers to produce The product is exactly the same to the end user, no matter how many processes it goes through. With this core "container", the entire ecosystem revolves around it.

In addition, compared with virtualization, virtualization is the virtualization of hardware and systems, while containers are virtualization of applications. It changes the running status of this virtual application in the form of modules (functions) and through environment variables (parameters of the function). At the same time, very large and complex services can be assembled with the help of orchestration tools.

伊谢尔伦

First of all, docker is not a virtual machine! ! no! ! no! !
Many people have opened a docker with mysql apache and other things! This is wrong!
Docker is a single-threaded program. Generally, a docker container can only open one application, so please do not use docker as a virtual machine.
Secondly, docker is theoretically an encapsulated sandbox environment. All changes are made in the environment and do not affect the system (of course you can mount it).
This is like a green software for windows, no installation required, just download and use.
Docker can be regarded as a green software packager for Linux. After the image is created, it can be run on any machine with docker. It does not require a lot of compilation, and it is fast and fast.
Okayヽ( ̄д ̄;)ノIf you still can’t understand, I’ll admit defeat. . .

phpcn_u1582

For example, if you use Ubuntu,服务器用的是CentOS,那么此时你要把项目部署到服务器上,可能在环境的配置上就要花费不少的时间了。又或者比如你用的MySQL,放在以前每次重装一次系统或者换一个环境,你就要把你的环境重装一次,东西越多花费的时间越多。
而使用Docker,你只需要一条命令,你就可以在你的Ubuntu上再运行一个“新的环境”,当然这一个环境还是基于你现有的环境的,也就是说实际上共享的还是同一套资源,但是这套环境里面已经有了你需要的东西。
你需要MySQL,那就安装一个带MySQL的镜像, 然后启动一个容器。
你需要Redis,那就安装一个带Redis的镜像, 然后启动一个容器。
你需要..., 那就..., 然后...。
当然你也可以在别人的基础之上,对容器进行修改后,比如添加了一些你自己的软件或修改配置文件,然后再commit,这样你就把这个容器制作成了一个镜像,以后你可以用这个镜像创建出N个一模一样的容器。
比如你要学习搭载Redis集群,那么你可以下载一个Redis的镜像,然后启动容器,把集群的配置设置好后,提交这个容器生成镜像,再根据这个镜像运行出6个或更多容器,这样一个集群就搭起来了。
而且Dockerit takes up very little resources.

習慣沉默

In short, what Docker can do for you is: compared to other technologies, it allows a larger number of applications to run on the same hardware; it makes it easy for developers to quickly build containerized applications that can be run at any time ; It greatly simplifies the task of managing and deploying applications.

滿天的星座

Isn’t it troublesome to configure the environment, install various dependencies and then run the code? If an error occurs during the dependency installation and configuration process, the code may not be able to run. Docker is a virtualization tool that can package the entire environment into an image and distribute it. When you need to use it, just pull down the image and run it, similar to Download a virtual machine image and run it locally.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!