• 欢迎访问db1024网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏db1024吧

Linux VPS使用Docker快速部署一个CentOS系统容器

建站知识 Liam 1年前 (2019-04-29) 361次浏览 9个评论 扫描二维码
文章目录[隐藏]

说明:我们很多都需要新系统来测试一些东西,如果没多的VPS服务器的话,就很蛋疼了。这时候我们可以在仅有的服务器上使用Docker部署一个新系统来供我们测试,测试完再直接清空容器,而不会影响到服务器本身,很方便。话说好像可以用这个方法在一个VPS上部署很多个类似NAT小鸡?只是与真NAT不同的是资源全部共享,一般玩玩还是可以的。这里就分享个由ilemonrain博主制作的CentOS镜像。

镜像

1、镜像说明
此镜像基于CentOS官方镜像制作而成,集成OpenSSH-ServerOpenSSH-Clientinitscripts(可以使用service命令)、EPEL镜像源、wgetpasswdtarunzip,满足最低运行环境需求,如果其他需要,请自行使用yum install进行安装。

受制于systendDocker上的兼容性,CentOS 7.x系统将无法使用systemd相关程序 (如systemctlservice等),如果后台启动服务的需要,请使用CentOS 6.x镜像,(默认拉取的镜像为CentOS 6.9)。

推荐使用最新的镜像(CentOS 6.9CentOS 7.4),受制于Docker本身机制,无法在yum update升级系统版本后reboot(重启)完成升级。所以除非特殊需要,否则建议你使用最新镜像,避免很多问题。

2、镜像标签

CentOS 7.4.1708 (7.4, 7.4.1708, 7) CentOS 7.3.1611 (7.3, 7.3.1611) CentOS 7.2.1511 (7.2, 7.2.1511) CentOS 7.1.1503 (7.1, 7.1.1503) CentOS 7.0.1406 (7.0, 7.0.1406) CentOS 6.9 (6.9, 6, latest) CentOS 6.8 (6.8) CentOS 6.7 (6.7) CentOS 6.6 (6.6) 

安装

1、安装Docker

#CentOS 6 rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum update -y yum -y install docker-io service docker start chkconfig docker on  #CentOS 7、Debian、Ubuntu curl -sSL https://get.docker.com/ | sh systemctl start docker systemctl enable docker.service 

2、拉取CentOS镜像
启动命令:

docker run -d -p 2222:22 --name CentOS-Docker ilemonrain/centos-sshd  

参数说明:

-d:以Daemon(后台)模式启动镜像 -p 2222:22:暴露宿主机的2222端口,映射到容器内部的22端口 (SSH) --name CentOS-Docker:容器名称 ilemonrain/centos-sshd:镜像名称 

请按照自己的实际需要,暴露对应的端口。

更多说明:

#如果需要暴露更多的内部端口,可以使用多个-p参数,比如-p 80:80 -p 53:53。如果需要区分协议,请在-p参数后面注明,比如-p 80:80/tcp -p 53:53/udp。  #ilemonrain/centos-sshd镜像默认为CentOS 6.9系统,如果你要安装CentOS 7.4,后面参数则为ilemonrain/centos-sshd:7.4,其它系统以此为参考。  #如果想部署多个CentOS系统容器,则注意将容器名称改成不同的即可! 

部署好了后,SSH登录信息:

用户名:root 密码:centos

请在成功登录SSH后,立即修改你的SSH密码,以防止被恶意爆破。


db1024 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Linux VPS使用Docker快速部署一个CentOS系统容器
喜欢 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(9)个小伙伴在吐槽
  1. WOW just what I was searching for. Came here by searching for website host
    website hosting companies2020-09-01 01:10 回复 Mac OS X | Chrome 66.0.3359.181
  2. Does your website have a contact page? I'm having trouble locating it but, I'd like to shoot you an email. I've got some creative ideas for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it develop over time.
    cheap flights2020-08-28 12:31 回复 Mac OS X | Safari浏览器 605.1.15
  3. What's up mates, how is the whole thing, and what you desire to say about this article, in my view its genuinely awesome designed for me. cheap flights 2CSYEon
    cheap flights2020-08-27 01:25 回复 Linux | Firefox浏览器 60.0.2
  4. I'm curious to find out what blog platform you are utilizing? I'm having some small security problems with my latest site and I would like to find something more risk-free. Do you have any solutions? 34pIoq5 cheap flights
    cheap flights2020-08-25 12:42 回复 Mac OS X | Firefox浏览器 62.0
  5. Thanks , I've just been looking for info about this topic for ages and yours is the best I have found out till now. But, what about the conclusion? Are you certain in regards to the supply? 3gqLYTc cheap flights
    cheap flights2020-08-25 10:52 回复 Linux | Chrome 66.0.3359.106
  6. Hello there! Do you use Twitter? I'd like to follow you if that would be okay. I'm definitely enjoying your blog and look forward to new updates.
    cheap flights2020-08-24 10:29 回复 Linux | Chrome 66.0.3359.139
  7. Good way of telling, and fastidious post to take facts on the topic of my presentation subject matter, which i am going to deliver in university.
    best web hosting company2020-08-14 08:40 回复 Mac OS X | Chrome 56.0.2986.42
  8. With havin so much content and articles do you ever run into any problems of plagorism or copyright violation? My blog has a lot of exclusive content I've either written myself or outsourced but it appears a lot of it is popping it up all over the web without my authorization. Do you know any techniques to help prevent content from being ripped off? I'd definitely appreciate it.
    content hosting2020-08-11 17:19 回复 Linux | Chrome 66.0.3359.158
  9. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your next post thank you once again. adreamoftrains web hosting company
    adreamoftrains website hosting services2020-08-11 01:05 回复 Mac OS X | Chrome 51.0.2704.84