简体   繁体   English

创建Docker容器,然后将Ansible剧本复制到它们

[英]Create Docker Containers and then copy Ansible playbook to them

We had a system where we used ansible to create Virtual Box vm's on Windows 7. We now have new linux laptops and I have both docker and ansible installed. 我们有一个使用ansible在Windows 7上创建Virtual Box vm的系统。我们现在有了新的linux笔记本电脑,同时安装了docker和ansible。 I am led to believe that I need to create 4 containers: 1 container with centos 6.8 which is strictly running our database. 我被认为需要创建4个容器:1个带有centos 6.8的容器,它严格运行我们的数据库。 1 container with centos 6.8 which is running tomcat8, activemq, and has jre 1.8. 1个具有centos 6.8的容器,该容器运行tomcat8,activemq,并且具有jre 1.8。 1 container with centos 6.8 which is running Apache Karaf. 1个具有centos 6.8的容器,它正在运行Apache Karaf。 1 container with centos 6.8 which is strictly running Apache HTTP server. 1个具有centos 6.8的容器,该容器严格运行Apache HTTP服务器。

Or, is the terminology is that these are 4 images that are running within Docker? 或者,术语是这些是在Docker中运行的4个映像?

I am led to believe that each of these (container/images) needs to have Ansible installed on each of these. 我被认为是这些(容器/图像)中的每一个都需要在其中每个上安装Ansible。 I feel that I have to move the Ansible Playbook to each one of these images, and then do: ansible-playbook myYamplFile.yml Each one of these playbooks, 4 of them, 1 for each image, is responsible for setting up the system within those containers. 我觉得我必须将Ansible Playbook移到以下每个图像上,然后执行:ansible-playbook myYamplFile.yml这些Playbook中的每一个(其中4个,每个图像1个)负责在其中设置系统这些容器。

if this is the case, how can I get a yaml file (playbook) over to the image, so I can be within that container and run it? 如果是这种情况,如何将yaml文件(剧本)移到映像上,以便可以在该容器中运行它?

Or, am I completely off, and will the playbook file create that image for me? 还是我完全离开了,剧本文件会为我创建该图像吗?

Or, might it be that it depends on what is actually in the file? 或者,可能取决于文件中的实际内容吗?

Thanks for any help! 谢谢你的帮助!

Create a Base Image which adds the yml file into a particular location 创建将yml文件添加到特定位置的基本映像

 FROM centos:6.8
 ADD myYamplFile.yml

And all other image : 和所有其他图像:

 FROM myPlaybookImage:latest
 bla bla

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM