Docker本身有很多优秀的镜像可供我们下载使用,但有时候依然满足不了我们的需求,比如博主在尝试了N多次通过Jdeathe的镜像进行PHP持续集成环境的整合一直是失败的,这时候我们就应该考虑去打造一款属于我们自已的镜像,使用最纯净的os底层,用原生的环境来实现我们的需求。本篇涉及到的架构如下图所示:
1、有朋友可能会说,既然我有不同的需求,那么我直接pull个纯净的镜像,然后起两个容器来分别做对应的功能不就可以了,何必要自已折腾一个镜像呢?首先,为了学习目的,做一个自已的镜像并熟悉制作镜像的过程是有必要的,其次,在以后扩展时,我们可以基于该镜像来进行扩展,可以保证应用基础环境的一致,当然方法是多种多样,今天我就先介绍这种较为折腾的做法,其他做法会在接下来的文章中体现。Ok,进入正题,我们先看看要达到的效果怎么样的:
2、既然是要定制一个镜像,自然不能用docker pull这种命令来获取一个现成的docker image,首先我们得选个比较快的OS镜像节点(传送门:http://blog.chinaunix.net/uid-25057421-id-4428048.html),不过我还是比较喜欢openvz的OS镜像(OpenVZ也提供了大量现成的镜像供下载),ok,这里以下载centos6为例子:
wget http://download.openvz.org/template/precreated/centos-7-x86_64.tar.gz
3、接下来,我们需要将下载的os镜像tar镜像导入,我们需要用到这个命令docker import:
sudo cat centos-6-x86_64.tar.gz |docker import – vmcloud/centos:7
4、接着我们根据前面几章所学创建Container01、Container02,由于我们在做镜像时并没有预先集成/bin/bash所以如果直接用docker run会提示缺少命令,这时我们需要使用以下命令创建:
sudo docker run -itd –name=con01 vmcloud/centos:6 /bin/bash
sudo docker run -itd –name=con02 vmcloud/centos:6 /bin/bash
5、接着我们进去c01去安装ssh与mysql:
docker exec -ti con01 /bin/bash
6、接着我们进去c02去安装apache与php:
docker exec -ti con02 /bin/bash
7、现在我们把con01、con02通过commit命令提交为固定镜像,名称为vmcloud_mysql_ssh:1于vmcloud_apache_php:1:
8、这样就通过源os镜像的方法去定制了自已的镜像,现在我们来测试下,我们用vmcloud_mysql_ssh创建一个Container并映射22、3306,为了后期监控及主机性能考虑,这里会用到两个新的参数,一个是-hostname,另外一个是-m,具体什么作用,后面的博文会介绍到:
9、将8022、8060在Azure上做映射,然后看看我们是否能够通过8022 ssh到我们所创建的容器里(请注意,开放ssh实际上并不推荐这么做,不过为了日后与system center整合,这里需要到,仅供评估):
PS:这里发现一个问题,在Container里设置了chkconfig后的服务并不会随着Container的启动而启动,这里是个小坑,将在以后学习docker的步伐中去慢慢摸索如何解决。
Ricobewtrwin is a bit of a mouthful, but it's a decent site. The layout is clean and easy to understand. Could use some more bonus offers though. See for yourself: ricobewtrwin
Perfect for sports fans. The live updates are spot on and the betting options are endless. I always use nbajjelogin for my weekly picks.
Honestly the best experience I've had in a while. The game variety is insane and the customer support is actually helpful. Big fans of rajabet818com over here!
The game variety is insane! I spent hours exploring the different options and everything works perfectly on my mobile phone. Big shoutout to b444bet
Solid platform with a fair gaming environment. I appreciate the transparency and the way they handle the promotions. bdg7777 is a winner in my book.
Best spot for slots right now. The bonuses are actually fair and not just bait. I'm spending most of my free time on jilip8casino lately.
Super impressed with the fairness of the games here. I feel like I actually have a chance to win. Really happy with idgg189 so far.
Great selection of live dealer games. It feels like I am actually in a real casino. I really enjoy the vibe at abcbet234.
I've been playing here for a few weeks now and the payouts are surprisingly fast. Really liking the vibe of maxwincasino so far!
Fast loading times and no annoying glitches. It is refreshing to find a site that actually works well on mobile devices. Five stars for sgo777login.