我应该使用Vagrant还是Docker创建一个孤立的环境? [英] Should I use Vagrant or Docker for creating an isolated environment?

查看:116
本文介绍了我应该使用Vagrant还是Docker创建一个孤立的环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ubuntu进行开发和部署,并且需要创建一个孤立的环境。

I use Ubuntu for development and deployment and have a need for creating an isolated environment.

我正在考虑Vagrant或Docker为此目的。这些解决方案是如何比较的?

I am considering either Vagrant or Docker for this purpose. What are the pros and cons, or how do these solutions compare?

推荐答案

如果您的目的是孤立,我认为Docker是你想要什么。

If your purpose is the isolation, I think Docker is what you want.

Vagrant是虚拟机管理员。它允许您对虚拟机配置以及配置进行脚本化。但是,它仍然是一个虚拟机,具体取决于 VirtualBox (或其他),具有巨大的开销。它需要你有一个可以是巨大的硬盘驱动器文件,它需要很多的RAM,性能可能不是很好。

Vagrant is a virtual machine manager. It allows you to script the virtual machine configuration as well as the provisioning. However, it is still a virtual machine depending on VirtualBox (or others) with a huge overhead. It requires you to have a hard drive file that can be huge, it takes a lot of ram, and performance may be not very good.

Docker另一方面使用内核cgroup和命名空间,通过 LXC 。这意味着您正在使用与主机和相同文件系统相同的内核。
您可以使用Dockerfile与 docker build 命令来处理容器的配置和配置。您可以在 docs.docker.com 上了解如何制作Docker文件的示例;这是非常直观的。

Docker on the other hand uses kernel cgroup and namespacing via LXC. It means that you are using the same kernel as the host and the same file system. You can use Dockerfile with the docker build command in order to handle the provisioning and configuration of your container. You have an example at docs.docker.com on how to make your Dockerfile; it is very intuitive.

您可能想要使用Vagrant的唯一原因是,如果您需要在Ubuntu框上进行BSD,Windows或其他非Linux开发。否则,去Docker。

The only reason you could want to use Vagrant is if you need to do BSD, Windows or other non-Linux development on your Ubuntu box. Otherwise, go for Docker.

这篇关于我应该使用Vagrant还是Docker创建一个孤立的环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆