使用Terraform设置Docker容器和网络 [英] Setting up Docker Containers and Network with Terraform

查看:223
本文介绍了使用Terraform设置Docker容器和网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Terraform的新手,我做了所有可以找到的相关教程。我已经建立了多个Docker容器和一个网络,目前以shell skript开始。总体计划是,要能够使用Terraform来启动我的测试平台及其所有组件(像具有Containernet,Router等的ONOS)。

I'm new to Terraform and just did all the Tutorials i could find about it. I have set up Multiple Docker Containers and a Network, Currently starting it with a shell skript. The general plan would be, to be able to start my testbed and all its components with Terraform (Like ONOS with containernet, Routers, ...).

我的第一个问题是Terraform针对此类问题提出的?还是您会提出其他建议。我认为使用Terraform将使编写新方案变得容易。
此时,我使用Shell skripts来构建和运行Docker容器。让Terraform执行RUN(而不是构建)任务有意义吗?

My First Question would, is Terraform made for that kind of Question? Or would you suggest anything different. I thought using Terraform would make it Easy to write new Scenarios. AT this Point I use the Shell skripts to build and run the Docker Containers. Does it make sense to let Terraform do the RUN (not build) task?

感谢您的帮助与支持;意见

Thanks for your Help & Opinions

我是Stack的新手,如果您解释一下不赞成投票将非常棒-这样我就可以学习做得更好。

I'm new to Stack, it would be awesome if you explain a downvote - so i can learn to do it better.

编辑(已删除构建文件-不必要)

edit ( Build file deleted - unnecassary)

推荐答案


总体规划是,能够开始我的测试平台及其所有组件与Terraform

The general plan would be, to be able to start my testbed and all its components with Terraform


Tl; Dr


不要这样做。

Tl;Dr

Don't do this.

这不是terraform的用途。 平台供应基础结构。因此(作为示例),如果要使用天蓝色函数,可以编写一个terraform文件,该文件d 描述其外观,然后运行terraform来创建它。 它(也不应该)运行您的功能。它只是描述了Azure在运行之前应如何创建这些结构。

This isn't what terraform is for. Terraform provisions infrastructure. So (as an example) if you want an azure function, you write a terraform file that describes what this looks like then run terraform to create it. It doesn't (nor should it) run your function. It simply describes how Azure should create these structures prior to them being ran.

似乎您实际上想要一个使用地形作为该过程的一部分的构建管线。供应基础设施。一旦terraform完成工作,构建脚本便会运行容器

It seems you actually want a build pipline that uses terraform as part of that process to provision the infrastructure. The build script would then run the containers once terraform had done it's job

这篇关于使用Terraform设置Docker容器和网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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