Since Docker is a LXC technology, it is bound to run multiple containers, the last time we configured the first container in Dokcer and implemented the Wordpress+mysql site, this time, we try to create two containers on the same Docker host.
650) this.width=650; "title=" clip_image002 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;float:none;padding-top:0px;padding-left:0px;margin-left:auto;padding-right:0px; Border-top-width:0px;margin-right:auto; "border=" 0 "alt=" clip_image002 "src=" Http://s3.51cto.com/wyfs02/M02/7E/8B /wkiol1cezmqsvxhmaaboluclksi175.jpg "width=" 549 "height=" 407 "/>
1, first, we have to achieve the effect of how, presumably this:
650) this.width=650; "title=" clip_image003 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image003" src= "Http://s3.51cto.com/wyfs02/M01/7E/8B/wKioL1cEZmvhID1TAABZq5UqQv4525.png" Width= "339" height= "383"/>
2, so we have to use the knowledge of the previous chapters to integrate to do such an experiment, first we need to pull the container OS, here we use jdeathe/ Centos-ssh-apache-php's image (because the apache+php has been built for us):
650) this.width=650; "title=" clip_image005 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image005" src= "Http://s3.51cto.com/wyfs02/M00/7E/8E/wKiom1cEZcDAOyoTAAA9xnt2uOo453.jpg" Width= "557" height= "/>"
3. Next, we use the following statement to create two container:
Docker run-itd--name=app01-p 8081:80 jdeathe/centos-ssh-apache-php
Docker run-itd--name=app02-p 8082:80 jdeathe/centos-ssh-apache-php
650) this.width=650; "title=" clip_image007 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image007" src= "Http://s3.51cto.com/wyfs02/M00/7E/8B/wKioL1cEZmziaUpbAABNS2a3G6I516.jpg" Width= "557" height= "/>"
4. Then we check the status:
650) this.width=650; "title=" clip_image009 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image009" src= "Http://s3.51cto.com/wyfs02/M01/7E/8B/wKioL1cEZm2y7jCLAAAsC4Nzo0Y260.jpg" Width= "559" height= "/>"
5, in order to be able to distinguish between 01 and 02, we enter the container to modify the next home file:
Docker Exec-ti App01/bin/bash
Docker Exec-ti App02/bin/bash
650) this.width=650; "title=" clip_image011 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image011" src= "Http://s3.51cto.com/wyfs02/M02/7E/8B/wKioL1cEZm2AQ--QAABNijI9kdM042.jpg" Width= "558" height= "104"/>
Likewise, this is done on the APP02, and then we visit to see if it takes effect:
650) this.width=650; "title=" clip_image013 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " Border= "0" alt= "clip_image013" src= "Http://s3.51cto.com/wyfs02/M00/7E/8B/wKioL1cEZm6zF5UvAAAyyVMTqgc703.jpg" Width= "557" height= "167"/>
Visit APP02:
650) this.width=650; "title=" clip_image015 "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt = "clip_image015" src= "http://s3.51cto.com/wyfs02/M01/7E/8B/wKioL1cEZm-CLiPxAAA1PmVldy8027.jpg" width= "557" Height = "149"/>
6. So far, we have successfully used Docker to create two Apache Container on a single machine.
650) this.width=650; "title=" logo "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; float:none;padding-top:0px;padding-left:0px;margin-left:auto;padding-right:0px;border-top-width:0px; Margin-right:auto, "border=" 0 "alt=" logo "src=" http://s3.51cto.com/wyfs02/M00/7E/8B/ Wkiol1ceznccgzcnaadvpc6tcse612.png "width=" 533 "height=" 347 "/>
This article from "Vmcloud" blog, declined reprint!
"Vmcloud Cloud Platform" embracing Docker (iii) configuring multiple containers