站点工具


服务器技术:docker:安装docker

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
服务器技术:docker:安装docker [2018/06/05 18:06]
admin 创建
服务器技术:docker:安装docker [2018/09/10 18:02] (当前版本)
行 1: 行 1:
-<h2> +<h2><​br/></​h2><​h2>​<a href="​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html">​Centos7上安装docker</​a></​h2><​p>​<br/></​p><​p><​span style="​font-size:​ 16px">​Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE。</​span></​p><​p><​span style="​font-size:​ 16px">​社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如经过官方测试认证过的基础设施、容器、插件等。</​span></​p><​p><​span style="​font-size:​ 16px">​社区版按照stable和edge两种方式发布,每个季度更新stable版本,如17.06,17.09;每个月份更新edge版本,如17.09,17.10。</​span></​p><​h2>&​nbsp;​一、安装docker</​h2><​p>​1、Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。</​p><​p>​通过&​nbsp;<​strong>​uname -r&​nbsp;</​strong>​命令查看你当前的内核版本</​p><​pre>&​nbsp;​$&​nbsp;​uname&​nbsp;​-r</​pre><​p><​span style="​font-size:​ 16px">​2、使用&​nbsp;<​code>​root</​code>&​nbsp;​权限登录 Centos。确保 yum 包更新到最新。</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​update</​pre><​p><​span style="​font-size:​ 16px">​3、卸载旧版本(如果安装过旧版本的话)</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​remove&​nbsp;​docker&​nbsp;&​nbsp;​docker-common&​nbsp;​docker-selinux&​nbsp;​docker-engine</​pre><​p><​span style="​font-size:​ 16px">​4、安装需要的软件包,&​nbsp;</​span><​span style="​font-size:​ 16px">​yum-util 提供yum-config-manager功能,</​span><​span class="​pln"​ style="​font-size:​ 16px"><​span class="​com">​另外两个是devicemapper驱动依赖的</​span></​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​-y&​nbsp;​yum-utils&​nbsp;​device-mapper-persistent-data&​nbsp;​lvm2</​pre><​p>​5、设置yum源</​p><​pre>​$&nbsp;&​nbsp;​sudo&​nbsp;​yum-config-manager&​nbsp;​--add-repo&​nbsp;​https://​download.docker.com/​linux/​centos/​docker-ce.repo</​pre><​p>&​nbsp;<​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158841130.png"​ alt=""/></​p><​p>​6、可以查看所有仓库中所有docker版本,并选择特定版本安装</​p><​pre>​$&​nbsp;​yum&​nbsp;​list&​nbsp;​docker-ce&​nbsp;​--showduplicates&​nbsp;​|&​nbsp;​sort&​nbsp;​-r</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158953553.png"​ alt=""/></​p><​p>​7、安装docker</​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce&​nbsp;&​nbsp;#​由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;&​lt;​FQPN&​gt;&​nbsp;&​nbsp;#&​nbsp;​例如:sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce-17.12.0.ce</​pre><​p>&​nbsp;<​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158168601.png"​ alt=""/></​p><​p><​span style="​font-size:​ 16px">​8、启动并加入开机启动</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​systemctl&​nbsp;​start&​nbsp;​docker 
- <a href="​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html">​Centos7上安装docker</​a>​ +$&​nbsp;​sudo&​nbsp;​systemctl&​nbsp;​enable&​nbsp;​docker</​pre><​p><​span style="​font-size:​ 16px">​9、验证安装是否成功(有client和service两部分表示docker安装启动都成功了)</​span></​p><​pre>​$&​nbsp;​docker&​nbsp;​version</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158728987.png"​ alt=""/></​p><​p>&​nbsp;</​p><​h2>&​nbsp;​二、问题</​h2><​p><​span style="​font-size:​ 16px">​1、因为之前已经安装过旧版本的docker,在安装的时候报错如下:</​span></​p><​p><​span class="​cnblogs_code_copy"><​a title="​复制代码"><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159785842.gif"​ alt="​复制代码"/></​a></​span></​p><​pre>​Transaction&​nbsp;​check&​nbsp;​error:&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker-containerd&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker-containerd-shim&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​dockerd&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64</​pre><​p><​span class="​cnblogs_code_copy"><​a title="​复制代码"><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159785842.gif"​ alt="​复制代码"/></​a></​span></​p><​p><​span style="​font-size:​ 16px">​2、卸载旧版本的包</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​erase&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159830412.png"​ alt=""/></​p><​p><​span style="​font-size:​ 16px">​3、再次安装docker</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce</​pre><​p><​br/></​p><​p><​br/></​p><​p><​a href="​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html"​ target="​_blank">​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html</​a></​p><​p><​br/></​p><​h1 class="​YaHei"​ style="​margin:​ 0px; padding: 0px 0px 5px; outline: none; font-size: 20px; font-weight:​ bold; font-family:​ &​quot;​Microsoft YaHei&​quot;;​ color: rgb(51, 51, 51); line-height:​ 35px; overflow: hidden; font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; letter-spacing:​ normal; orphans: 2; text-align: start; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);">​docker测试时候命令无法补全的解决方法</​h1><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);"><​span style="​line-height:​ 25.2px; font-size: 14px; color: rgb(255, 0, 0);"><​strong>​发现问题</​strong></​span></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);">​在输入docker swarm 然后tab键不能像这样进行提示 和补全<​br/></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);">​tab 键也无法补全nginx容器名,下面是运行截图<​br/></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255); text-align: center;"><​a href="​https://​files.jb51.net/​file_images/​article/​201611/​2016115101639480.png?​2016105101650"​ target="​_blank"​ class="​bPic"​ style="​color:​ rgb(66, 139, 202); text-decoration:​ none; font-size: 14px;"><​img src="​https://​files.jb51.net/​file_images/​article/​201611/​2016115101639480.png?​2016105101650"​ alt=""​ width="​1428"​ height="​171"/></​a></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255); text-align: center;"><​img src="​https://​files.jb51.net/​file_images/​article/​201611/​2016115101711227.png?​2016105101720"​ alt=""/></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);"><​span style="​line-height:​ 25.2px; font-size: 14px; color: rgb(255, 0, 0);"><​strong>​解决方法:</​strong></​span></​p><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);"><​span style="​line-height:​ 25.2px; font-size: 14px; color: rgb(255, 0, 0);"><​strong>​yum install -y bash-completion</​strong></​span><​br/></​p><​p><​span style="​line-height:​ 25.2px; font-size: 14px;"><​a href="​https://​www.jb51.net/​article/​96555.htm#"​ class="​toolbar_item command_help help" style="​color:​ rgb(66, 139, 202); text-decoration:​ none; border-radius:​ 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 1px 0px 0px !important; position: static !important; right: auto !important; text-align: center !important; top: auto !important; vertical-align:​ baseline !important; width: auto !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 14px; min-height: auto !important; display: block !important;">?</​a></​span></​p><​table width="​643"><​tbody style="​border-radius:​ 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: auto !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;"><​tr style="​border-radius:​ 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: auto !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;"​ class="​firstRow"><​td class="​gutter"​ style="​margin:​ 0px !important; padding: 0.2em 0.46em; outline: currentcolor none 0px !important; border-radius:​ 0px !important; background: rgba(0, 0, 0, 0) none repeat scroll 0% 0% !important; border: 1px solid rgb(204, 204, 204); bottom: auto !important; float: none !important; left: auto !important; line-height:​ 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; text-align: left; top: auto !important; vertical-align:​ baseline !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important; color: rgb(175, 175, 175) !important;"​ width="​NaN"><​div class="​line number1 index0 alt2" style="​margin:​ 0px !important; padding: 0px 0.5em 0px 1em !important; outline: 0px !important; border-radius:​ 0px !important; background: none white !important; border-width:​ 0px 3px 0px 0px !important; border-top-style:​ initial !important; border-right-style:​ solid !important; border-bottom-style:​ initial !important; border-left-style:​ initial !important; border-top-color:​ initial !important; border-right-color:​ rgb(108, 226, 108) !important; border-bottom-color:​ initial !important; border-left-color:​ initial !important; border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 15.4px; overflow: visible !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align:​ baseline !important; width: auto !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 14px; min-height: auto !important; white-space:​ pre !important;">​1</​div></​td><​td class="​code"​ style="​margin:​ 0px !important; padding: 0.2em 0.46em; outline: currentcolor none 0px !important; border-radius:​ 0px !important; background: rgba(0, 0, 0, 0) none repeat scroll 0% 0% !important; border: 1px solid rgb(204, 204, 204); bottom: auto !important; float: none !important; left: auto !important; line-height:​ 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; text-align: left; top: auto !important; vertical-align:​ baseline !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 1em !important; min-height: auto !important;"​ width="​611"><​div class="​line number1 index0 alt2" style="​margin:​ 0px !important; padding: 0px 1em !important; outline: 0px !important; border-radius:​ 0px !important; background: none white !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 15.4px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: auto !important; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-weight:​ normal !important; font-style: normal !important; font-size: 14px; min-height: auto !important; white-space:​ pre !important;"><​p><​code class="​bash plain" style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: black !important; clear: both;">​yum </​code><​code class="​bash functions"​ style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: rgb(255, 20, 147) !important; clear: both;">​install</​code>​ <code class="​bash plain" style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: black !important; clear: both;">​-y </​code><​code class="​bash functions"​ style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: rgb(255, 20, 147) !important; clear: both;">​bash</​code><​code class="​bash plain" style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: black !important; clear: both;">​-completion</​code></​p><​p><​code class="​bash plain" style="​margin:​ 3px auto 0px; padding: 0px 0px 0px 5px; outline: 0px !important; font-style: normal !important; font-weight:​ normal !important; border-radius:​ 0px !important; background: rgb(255, 255, 255); border-top: 0px !important; border-right:​ 0px !important; border-bottom:​ 0px !important; border-left:​ 3px solid rgb(108, 226, 108); border-image:​ initial !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height:​ 20px; overflow: visible !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align:​ baseline !important; width: 640px; box-sizing: content-box !important; font-family:​ Consolas, &​quot;​Bitstream Vera Sans Mono&​quot;,​ &​quot;​Courier New&​quot;,​ Courier, monospace !important; font-size: 14px; min-height: auto !important; color: black !important; clear: both;"><​br/></​code></​p></​div></​td></​tr></​tbody></​table><​p style="​margin:​ 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height:​ 30px; color: rgb(34, 34, 34); font-family:​ tahoma, arial, &​quot;​Microsoft YaHei&​quot;;​ font-style: normal; font-variant-ligatures:​ normal; font-variant-caps:​ normal; font-weight:​ normal; letter-spacing:​ normal; orphans: 2; text-align: left; text-indent:​ 0px; text-transform:​ none; white-space:​ normal; widows: 2; word-spacing:​ 0px; -webkit-text-stroke-width:​ 0px; background-color:​ rgb(255, 255, 255);">​退出 后重进就正常了</​p><​p><​br/></​p>​
- </​h2><​p>​ +
- </​p><​p><​span style="​font-size:​ 16px">​Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE。</​span></​p><​p><​span style="​font-size:​ 16px">​社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如经过官方测试认证过的基础设施、容器、插件等。</​span></​p><​p><​span style="​font-size:​ 16px">​社区版按照stable和edge两种方式发布,每个季度更新stable版本,如17.06,17.09;每个月份更新edge版本,如17.09,17.10。</​span></​p><​h2>&​nbsp;​一、安装docker</​h2><​p>​1、Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。</​p><​p>​通过&​nbsp;<​strong>​uname -r&​nbsp;</​strong>​命令查看你当前的内核版本</​p><​pre>&​nbsp;​$&​nbsp;​uname&​nbsp;​-r</​pre><​p><​span style="​font-size:​ 16px">​2、使用&​nbsp;<​code>​root</​code>&​nbsp;​权限登录 Centos。确保 yum 包更新到最新。</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​update</​pre><​p><​span style="​font-size:​ 16px">​3、卸载旧版本(如果安装过旧版本的话)</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​remove&​nbsp;​docker&​nbsp;&​nbsp;​docker-common&​nbsp;​docker-selinux&​nbsp;​docker-engine</​pre><​p><​span style="​font-size:​ 16px">​4、安装需要的软件包,&​nbsp;</​span><​span style="​font-size:​ 16px">​yum-util 提供yum-config-manager功能,</​span><​span class="​pln"​ style="​font-size:​ 16px"><​span class="​com">​另外两个是devicemapper驱动依赖的</​span></​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​-y&​nbsp;​yum-utils&​nbsp;​device-mapper-persistent-data&​nbsp;​lvm2</​pre><​p>​5、设置yum源</​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum-config-manager&​nbsp;​--add-repo&​nbsp;​https://​download.docker.com/​linux/​centos/​docker-ce.repo</​pre><​p>&​nbsp;<​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158841130.png"​ alt=""/></​p><​p>​6、可以查看所有仓库中所有docker版本,并选择特定版本安装</​p><​pre>​$&​nbsp;​yum&​nbsp;​list&​nbsp;​docker-ce&​nbsp;​--showduplicates&​nbsp;​|&​nbsp;​sort&​nbsp;​-r</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158953553.png"​ alt=""/></​p><​p>​7、安装docker</​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce&​nbsp;&​nbsp;#​由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;&​lt;​FQPN&​gt;&​nbsp;&​nbsp;#&​nbsp;​例如:sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce-17.12.0.ce</​pre><​p>&​nbsp;<​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158168601.png"​ alt=""/></​p><​p><​span style="​font-size:​ 16px">​8、启动并加入开机启动</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​systemctl&​nbsp;​start&​nbsp;​docker +
-$&​nbsp;​sudo&​nbsp;​systemctl&​nbsp;​enable&​nbsp;​docker</​pre><​p><​span style="​font-size:​ 16px">​9、验证安装是否成功(有client和service两部分表示docker安装启动都成功了)</​span></​p><​pre>​$&​nbsp;​docker&​nbsp;​version</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193158728987.png"​ alt=""/></​p><​p>&​nbsp;</​p><​h2>&​nbsp;​二、问题</​h2><​p><​span style="​font-size:​ 16px">​1、因为之前已经安装过旧版本的docker,在安装的时候报错如下:</​span></​p><​p><​span class="​cnblogs_code_copy"><​a title="​复制代码"><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159785842.gif"​ alt="​复制代码"/></​a></​span></​p><​pre>​Transaction&​nbsp;​check&​nbsp;​error:&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker-containerd&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​docker-containerd-shim&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64&​nbsp;&​nbsp;​file&​nbsp;/​usr/​bin/​dockerd&​nbsp;​from&​nbsp;​install&​nbsp;​of&​nbsp;​docker-ce-17.12.0.ce-1.el7.centos.x86_64&​nbsp;​conflicts&​nbsp;​with&​nbsp;​file&​nbsp;​from&​nbsp;​package&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64</​pre><​p><​span class="​cnblogs_code_copy"><​a title="​复制代码"><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159785842.gif"​ alt="​复制代码"/></​a></​span></​p><​p><​span style="​font-size:​ 16px">​2、卸载旧版本的包</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​erase&​nbsp;​docker-common-2:​1.12.6-68.gitec8512b.el7.centos.x86_64</​pre><​p><​img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180605/​1528193159830412.png"​ alt=""/></​p><​p><​span style="​font-size:​ 16px">​3、再次安装docker</​span></​p><​pre>​$&​nbsp;​sudo&​nbsp;​yum&​nbsp;​install&​nbsp;​docker-ce</​pre><​p><​br/></​p><​p><​br/></​p><​p><​a href="​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html"​ target="​_blank">​https://​www.cnblogs.com/​yufeng218/​p/​8370670.html</​a><​br/></​p>​+
服务器技术/docker/安装docker.1528193186.txt.gz · 最后更改: 2018/09/10 18:01 (外部编辑)