简体   繁体   中英

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. I am led to believe that I need to create 4 containers: 1 container with centos 6.8 which is strictly running our database. 1 container with centos 6.8 which is running tomcat8, activemq, and has jre 1.8. 1 container with centos 6.8 which is running Apache Karaf. 1 container with centos 6.8 which is strictly running Apache HTTP server.

Or, is the terminology is that these are 4 images that are running within Docker?

I am led to believe that each of these (container/images) needs to have Ansible installed on each of these. 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.

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?

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

 FROM centos:6.8
 ADD myYamplFile.yml

And all other image :

 FROM myPlaybookImage:latest
 bla bla

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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