Vagrant和Docker与微服务 [英] Vagrant and Docker with Microservices

查看:113
本文介绍了Vagrant和Docker与微服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一套微服务器,我想使用Docker进行自动化和标准化。我一直在阅读有关Vagrant的信息,而且有关于使用Vagrant设置环境的几个问题。


  1. 我明白Vagrant用于设置VM和Docker来创建容器。在VM内运行Docker容器有什么好处?首先,它是否打败了Docker的目的?


  2. Vagrant与Docker之间的互动如何发生?我使用Vagrant创建的虚拟机是否包含Docker内的Docker?



解决方案

第一个问题的答案:



Vagrant是一种在本地计算机上快速设置基于docker的容器的方法。要运行docker容器,您需要通过在物理机上运行容器来提供linux内核。但是,有流氓的配置和运行容器将受益如下


  1. 您可以随时安全地移除容器。


第二个问题的答案:


$流氓人员直接与码头集装箱通讯。 VM上的每个Docker容器都拥有自己的IP和空间。您可以根据您的机器需要修改移动端口转发文件。



希望它有帮助。


I have a set of microservices whose deployment I would like to automate and standardize using Docker. I have been reading about Vagrant and I have a couple of questions on using Vagrant for setting up the environment.

  1. I understand that Vagrant is used for setting up VM's and Docker for creating containers. What is the benefit of running a Docker container inside a VM? Doesn't it defeat the purpose of using Docker in the first place?

  2. How is the interaction between Vagrant and Docker happening? Does the VM that I create using Vagrant contain Docker running inside it?

解决方案

Answer for first question:

Vagrant is a way to quickly setup docker based container on your local machine. To run docker containers, you need linux kernel which you can provide either by running container on your physical machine. But having vagrant's provisioned vm and running containers will benefit in following way

  1. You can safely remove containers anytime.
  2. You can automate all docker commands via vagrant script.

Answer to second question:

Vagrant directly communicates with docker containers. Each docker container on VM gets their own IP and space. You may modify vagrant file for port forwarding per your machine need.

Hope it helps.

这篇关于Vagrant和Docker与微服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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