<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>meisw's blog</title>
		<link>http://meisw.wdlinux.cn//</link>
		<description>工作,学习,生活,这里将会有一些记录.     备用域名:http://meisw.wdlinux.cn</description>
		<copyright>Copyright (C) 2004 Security Angel Team [S4T] All Rights Reserved.</copyright>
		<generator>SaBlog-X Version 1.6 Build 20080806</generator>
		<lastBuildDate>Sat, 30 May 2026 01:05:46 +0000</lastBuildDate>
		<ttl>30</ttl>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1081-1.html</guid>
			<title>docker源</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span class="rd_inl_code" style="font-family: Consolas, Courier, monospace; background: var(--smtc-background-card-on-primary-default-hover); border-radius: var(--smtc-ctrl-badge-sm-corner); border: 1px solid var(--smtc-stroke-ctrl-on-neutral-rest); padding: 1px var(--smtc-gap-between-content-xx-small); box-sizing: border-box; color: var(--bing-smtc-foreground-content-neutral-secondary-alt); overflow-wrap: anywhere;">/etc/docker/daemon.json</span></p>
<div><span class="rd_inl_code" style="font-family: Consolas, Courier, monospace; background: var(--smtc-background-card-on-primary-default-hover); border-radius: var(--smtc-ctrl-badge-sm-corner); border: 1px solid var(--smtc-stroke-ctrl-on-neutral-rest); padding: 1px var(--smtc-gap-between-content-xx-small); box-sizing: border-box; color: var(--bing-smtc-foreground-content-neutral-secondary-alt); overflow-wrap: anywhere;"><br />
</span></div>
<div><span class="rd_inl_code" style="background: var(--smtc-background-card-on-primary-default-hover); border-radius: var(--smtc-ctrl-badge-sm-corner); border: 1px solid var(--smtc-stroke-ctrl-on-neutral-rest); padding: 1px var(--smtc-gap-between-content-xx-small); box-sizing: border-box; overflow-wrap: anywhere;">
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">{</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace; padding-left: 8px;">&quot;registry-mirrors&quot;: [</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace; padding-left: 16px;"><span style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt);">&quot;https://mirror.baidubce.com&quot;,</span></div>
<div style="padding-left: 16px;"><font face="Consolas, Courier, monospace">&quot;https://mirror.aliyuncs.com&quot;</font></div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace; padding-left: 8px;">]</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">}</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">&nbsp;</div>
<div style="">
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">systemctl daemon-reload</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">systemctl restart docker</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">&nbsp;</div>
<div style="color: var(--bing-smtc-foreground-content-neutral-secondary-alt); font-family: Consolas, Courier, monospace;">&nbsp;</div>
<div style="">
<div style=""><font face="Consolas, Courier, monospace">{</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &quot;registry-mirrors&quot;: [</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://9cpn8tt6.mirror.aliyuncs.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://registry.docker-cn.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://mirror.ccs.tencentyun.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.1panel.live&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.m.daocloud.io&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://hub-mirror.c.163.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://mirror.baidubce.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://your_preferred_mirror&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://dockerhub.icu&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.registry.cyou&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker-cf.registry.cyou&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://dockercf.jsdelivr.fyi&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.jsdelivr.fyi&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://dockertest.jsdelivr.fyi&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://mirror.aliyuncs.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://dockerproxy.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://mirror.baidubce.com&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.m.daocloud.io&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.nju.edu.cn&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.mirrors.sjtug.sjtu.edu.cn&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.mirrors.ustc.edu.cn&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://mirror.iscas.ac.cn&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.rainbond.cc&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.1ms.run&quot;,</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; &nbsp; &quot;https://docker.1panel.live/&quot;</font></div>
<div style=""><font face="Consolas, Courier, monospace">&nbsp; ]</font></div>
<div style=""><font face="Consolas, Courier, monospace">}</font></div>
</div>
</div>
</span></div>]]></description>
			<link>http://meisw.wdlinux.cn//show-1081-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2026-03-18 19:03</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-944-1.html</guid>
			<title>使用Docker Compose管理多个容器</title>
			<author>admin</author>
			<description><![CDATA[<div><blockquote style="box-sizing: border-box; padding: 0px 15px; margin: 0px 0px 16px; border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); color: rgb(119, 119, 119); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">Docker Compose是一个用来定义和运行复杂应用的Docker工具。使用Compose，你可以在一个文件中定义一个多容器应用，然后使用一条命令来启动你的应用，完成一切准备工作。<br style="box-sizing: border-box;" />
- github.com/docker/compose</blockquote><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">一个使用Docker容器的应用，通常由多个容器组成。使用Docker Compose，不再需要使用shell脚本来启动容器。在配置文件中，所有的容器通过</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">services</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">来定义，然后使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">脚本来启动，停止和重启应用，和应用中的服务以及所有依赖服务的容器。完整的命令列表如下：</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<blockquote style="box-sizing: border-box; padding: 0px 15px; margin: 0px 0px 16px; border-left-width: 4px; border-left-style: solid; border-left-color: rgb(221, 221, 221); color: rgb(119, 119, 119); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;"><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">build</code>&nbsp;构建或重建服务<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">help</code>&nbsp;命令帮助<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">kill</code>&nbsp;杀掉容器<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">logs</code>&nbsp;显示容器的输出内容<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">port</code>&nbsp;打印绑定的开放端口<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">ps</code>&nbsp;显示容器<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">pull</code>&nbsp;拉取服务镜像<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">restart</code>&nbsp;重启服务<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">rm</code>&nbsp;删除停止的容器<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">run</code>&nbsp;运行一个一次性命令<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">scale</code>&nbsp;设置服务的容器数目<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">start</code>&nbsp;开启服务<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">stop</code>&nbsp;停止服务<br style="box-sizing: border-box;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; background-color: rgb(249, 242, 244);">up</code>&nbsp;创建并启动容器</blockquote><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">参考&nbsp;</span><a href="https://docs.docker.com/compose/install/" rel="nofollow" target="_blank" style="box-sizing: border-box; color: rgb(21, 95, 170); text-decoration: none; cursor: pointer; font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0px 0px; background-repeat: initial;">https://docs.docker.com/compose/install/</a><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">&nbsp;。你能运行Compose在OSX和64位Linux。当前不支持Windows操作系统。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<h3 style="box-sizing: border-box; font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.7; color: rgb(51, 51, 51); margin: 16px 0px; font-size: 1.5em;">8.1. 安装Docker Compose</h3>
<pre class="prettyprint" style="box-sizing: border-box; overflow: hidden; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 16px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; border: none; border-radius: 3px; background-color: rgb(247, 247, 247);">curl&nbsp;-L&nbsp;https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname&nbsp;-s`-`uname&nbsp;-m`&nbsp;&gt;&nbsp;/usr/local/bin/docker-compose chmod&nbsp;&nbsp;x&nbsp;/usr/local/bin/docker-compose</pre>
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<h3 style="box-sizing: border-box; font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.7; color: rgb(51, 51, 51); margin: 16px 0px; font-size: 1.5em;">8.2. 配置文件</h3>
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">1.Compose的配置文件是</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose.yml</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">。让我们看看下面这个文件：</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<pre class="prettyprint" style="box-sizing: border-box; overflow: hidden; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 16px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; border: none; border-radius: 3px; background-color: rgb(247, 247, 247);">mysqldb: image:&nbsp;[classroom.example.com:5000/]mysql environment: MYSQL_DATABASE:&nbsp;sample MYSQL_USER:&nbsp;mysql MYSQL_PASSWORD:&nbsp;mysql MYSQL_ROOT_PASSWORD:&nbsp;supersecret mywildfly: image:&nbsp;[classroom.example.com:5000|arungupta]/wildfly-mysql-javaee7 links: -&nbsp;mysqldb:db ports: -&nbsp;8080</pre>
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">这个文件在&nbsp;</span><a href="https://raw.githubusercontent.com/redhat-developer/docker-java/javaone2015/attendees/" rel="nofollow" target="_blank" style="box-sizing: border-box; color: rgb(21, 95, 170); text-decoration: none; cursor: pointer; font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0px 0px; background-repeat: initial;">https://raw.githubusercontent. ... dees/</a><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">&nbsp;，它表明：</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">a. 定义了两个服务分别叫做</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">mysqldb</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">和</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">mywildfy</code><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">b. 使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">image</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">定义每个服务的镜像名</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">c. MySQL容器的环境变量定义在</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">environment</code><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">d. MySQL容器使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">links</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">和WildFly容器链接</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">e. 使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">ports</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">实现端口转发</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<h3 style="box-sizing: border-box; font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 500; line-height: 1.7; color: rgb(51, 51, 51); margin: 16px 0px; font-size: 1.5em;">8.3. 启动服务</h3>
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">1.如果你从互联网运行，将</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose-internet.yml</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">保存为</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose.yml</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">2.如果你使用教师给的镜像，将</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose-instructor.yml</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">保存为</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker-compose.yml</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">3.使用下面的命令，所有的服务将使用后台模式被启动</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<pre class="prettyprint" style="box-sizing: border-box; overflow: hidden; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 16px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; border: none; border-radius: 3px; background-color: rgb(247, 247, 247);">docker-compose&nbsp;up&nbsp;-d</pre>
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">显示的输出如下：</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">Creating attendees_mysqldb_1...&nbsp;Creating attendees_mywildfly_1...</code><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">-f</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">指定代替的compose文件。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">-p</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">指定代替compose文件所在的目录。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">4.验证启动的服务</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<pre class="prettyprint" style="box-sizing: border-box; overflow: hidden; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 16px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; border: none; border-radius: 3px; background-color: rgb(247, 247, 247);">docker-compose&nbsp;ps &nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ports attendees_mysqldb_1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/entrypoint.sh&nbsp;mysqld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Up&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3306/tcp attendees_mywildfly_1&nbsp;&nbsp;&nbsp;/opt/jboss/wildfly/customi&nbsp;...&nbsp;&nbsp;&nbsp;Up&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0:32773-&gt;8080/tcp</pre>
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">这里提供了一个整合的列表显示所有启动的服务和容器。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">同时，通常使用</span><code class="prettyprint" style="box-sizing: border-box; font-family: 'Courier New', Courier, monospace; padding: 0px 5px; color: rgb(199, 37, 78); border-radius: 4px; display: inline-block; margin: 0px; line-height: 25.2px; background-color: rgb(249, 242, 244);">docker ps</code><span style="color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;">命令来验证应用的容器，和在Docker主机上运行的其他容器。</span><br style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: 'Helvetica Neue', STHeiti, 'Microsoft YaHei', Helvetica, Arial, sans-serif; line-height: 25.2px;" />
<pre class="prettyprint" style="box-sizing: border-box; overflow: hidden; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; padding: 16px; margin-top: 0px; margin-bottom: 10px; line-height: 20px; color: rgb(51, 51, 51); word-break: break-all; word-wrap: break-word; border: none; border-radius: 3px; background-color: rgb(247, 247, 247);">docker&nbsp;ps CONTAINER&nbsp;ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IMAGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COMMAND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CREATED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STATUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PORTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NAMES 3598e545bd2f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arungupta/wildfly-mysql-javaee7:latest&nbsp;&nbsp;&nbsp;&quot;/opt/jboss/wildfly/&nbsp;&nbsp;&nbsp;59&nbsp;seconds&nbsp;ago&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Up&nbsp;58&nbsp;seconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.0.0.0:32773-&gt;8080/tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attendees_mywildfly_1 b8cf6a3d518b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysql:latest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;/entrypoint.sh&nbsp;mysq&nbsp;&nbsp;&nbsp;2&nbsp;minutes&nbsp;ago&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Up&nbsp;2&nbsp;minutes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3306/tcp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attendees_mysqldb_1</pre>
</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>http://dockone.io/article/834</div>]]></description>
			<link>http://meisw.wdlinux.cn//show-944-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2017-05-10 09:28</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-860-1.html</guid>
			<title>docker install in centos7</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;vi /etc/yum.repos.d/docker.repo</p>
<div>[dockerrepo]</div>
<div>name=Docker Repository</div>
<div>baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/</div>
<div>enabled=1</div>
<div>gpgcheck=1</div>
<div>gpgkey=https://yum.dockerproject.org/gpg</div>
<div>&nbsp;</div>
<div>yum install docker-engine</div>
<div>&nbsp;</div>
<div>
<div>systemctl enable docker.service&nbsp;</div>
<div>systemctl start docker</div>
</div>]]></description>
			<link>http://meisw.wdlinux.cn//show-860-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2016-12-12 23:14</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-851-1.html</guid>
			<title>Docker 清理命令集锦</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span style="font-family: tahoma, arial, 宋体; line-height: 25.2px;">杀死所有正在运行的容器</span></p>
<div class="codetitle" style="margin: 3px auto 0px; padding: 0px 3px; width: 640px; clear: both; border-top-color: rgb(0, 153, 204); border-right-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; line-height: 25.2px; font-family: tahoma, arial, 宋体; background: rgb(242, 246, 251);"><span style="line-height: 21.6px; font-size: 12px; float: right;"><a data="21804" class="copybut" id="copybut21804" style="color: rgb(51, 51, 51); cursor: pointer;"><u>复制代码</u></a></span>代码如下:</div>
<div class="codebody" id="code21804" style="margin: 0px auto 3px; padding: 0px 3px 0px 5px; line-height: 25.2px; border: 1px solid rgb(0, 153, 204); width: 638px; clear: both; font-family: tahoma, arial, 宋体; background: rgb(221, 237, 251);">docker kill $(docker ps -a -q)</div>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;删除所有已经停止的容器</p>
<div class="codetitle" style="margin: 3px auto 0px; padding: 0px 3px; width: 640px; clear: both; border-top-color: rgb(0, 153, 204); border-right-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; line-height: 25.2px; font-family: tahoma, arial, 宋体; background: rgb(242, 246, 251);"><span style="line-height: 21.6px; font-size: 12px; float: right;"><a data="13518" class="copybut" id="copybut13518" style="color: rgb(51, 51, 51); cursor: pointer;"><u>复制代码</u></a></span>代码如下:</div>
<div class="codebody" id="code13518" style="margin: 0px auto 3px; padding: 0px 3px 0px 5px; line-height: 25.2px; border: 1px solid rgb(0, 153, 204); width: 638px; clear: both; font-family: tahoma, arial, 宋体; background: rgb(221, 237, 251);">docker rm $(docker ps -a -q)</div>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;删除所有未打 dangling 标签的镜像</p>
<div class="codetitle" style="margin: 3px auto 0px; padding: 0px 3px; width: 640px; clear: both; border-top-color: rgb(0, 153, 204); border-right-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; line-height: 25.2px; font-family: tahoma, arial, 宋体; background: rgb(242, 246, 251);"><span style="line-height: 21.6px; font-size: 12px; float: right;"><a data="91492" class="copybut" id="copybut91492" style="color: rgb(51, 51, 51); cursor: pointer;"><u>复制代码</u></a></span>代码如下:</div>
<div class="codebody" id="code91492" style="margin: 0px auto 3px; padding: 0px 3px 0px 5px; line-height: 25.2px; border: 1px solid rgb(0, 153, 204); width: 638px; clear: both; font-family: tahoma, arial, 宋体; background: rgb(221, 237, 251);">docker rmi $(docker images -q -f dangling=true)</div>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;删除所有镜像</p>
<div class="codetitle" style="margin: 3px auto 0px; padding: 0px 3px; width: 640px; clear: both; border-top-color: rgb(0, 153, 204); border-right-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; line-height: 25.2px; font-family: tahoma, arial, 宋体; background: rgb(242, 246, 251);"><span style="line-height: 21.6px; font-size: 12px; float: right;"><a data="31013" class="copybut" id="copybut31013" style="color: rgb(51, 51, 51); cursor: pointer;"><u>复制代码</u></a></span>代码如下:</div>
<div class="codebody" id="code31013" style="margin: 0px auto 3px; padding: 0px 3px 0px 5px; line-height: 25.2px; border: 1px solid rgb(0, 153, 204); width: 638px; clear: both; font-family: tahoma, arial, 宋体; background: rgb(221, 237, 251);">docker rmi $(docker images -q)</div>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;为这些命令创建别名</p>
<div class="codetitle" style="margin: 3px auto 0px; padding: 0px 3px; width: 640px; clear: both; border-top-color: rgb(0, 153, 204); border-right-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-top-width: 1px; border-right-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-left-style: solid; line-height: 25.2px; font-family: tahoma, arial, 宋体; background: rgb(242, 246, 251);"><span style="line-height: 21.6px; font-size: 12px; float: right;"><a data="12450" class="copybut" id="copybut12450" style="color: rgb(51, 51, 51); cursor: pointer;"><u>复制代码</u></a></span>代码如下:</div>
<div class="codebody" id="code12450" style="margin: 0px auto 3px; padding: 0px 3px 0px 5px; line-height: 25.2px; border: 1px solid rgb(0, 153, 204); width: 638px; clear: both; font-family: tahoma, arial, 宋体; background: rgb(221, 237, 251);"># ~/.bash_aliases</div>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;"># 杀死所有正在运行的容器.<br />
alias dockerkill='docker kill $(docker ps -a -q)'</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;"># 删除所有已经停止的容器.<br />
alias dockercleanc='docker rm $(docker ps -a -q)'</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;"># 删除所有未打标签的镜像.<br />
alias dockercleani='docker rmi $(docker images -q -f dangling=true)'</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;"># 删除所有已经停止的容器和未打标签的镜像.<br />
alias dockerclean='dockercleanc || true &amp;&amp; dockercleani'</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">另附上docker常用命令</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">docker version #查看版本</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;docker search tutorial#搜索可用docker镜像</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;docker pull learn/tutorial #下载镜像</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;docker run learn/tutorial echo &quot;hello word&quot;#在docker容器中运行hello world!</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">&nbsp;docker run learn/tutorial apt-get install -y ping#在容器中安装新的程序</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">保存镜像</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">首先使用docker ps -l命令获得安装完ping命令之后容器的id。然后把这个镜像保存为learn/ping。<br />
&nbsp;提示：<br />
&nbsp;1.运行docker commit，可以查看该命令的参数列表。<br />
&nbsp;2.你需要指定要提交保存容器的ID。(译者按：通过docker ps -l 命令获得)<br />
&nbsp;3.无需拷贝完整的id，通常来讲最开始的三至四个字母即可区分。（译者按：非常类似git里面的版本号)<br />
&nbsp;正确的命令：<br />
docker commit 698 learn/ping</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">运行新的镜像</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">docker run lean/ping ping&nbsp;<a href="http://www.google.com/" style="color: rgb(0, 102, 153); text-decoration: none;">www.google.com</a></p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">检查运行中的镜像</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">现在你已经运行了一个docker容器，让我们来看下正在运行的容器。<br />
&nbsp;使用docker ps命令可以查看所有正在运行中的容器列表，使用docker inspect命令我们可以查看更详细的关于某一个容器的信息。<br />
&nbsp;目标：</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">查找某一个运行中容器的id，然后使用docker inspect命令查看容器的信息。<br />
&nbsp;提示：</p>
<p style="margin-bottom: 0px; padding-top: 5px; padding-bottom: 5px; font-family: tahoma, arial, 宋体; line-height: 25.2px;">可以使用镜像id的前面部分，不需要完整的id。<br />
&nbsp;正确的命令：<br />
docker inspect efe</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-851-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2016-12-08 22:43</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-850-1.html</guid>
			<title>Docker 技巧：删除 Docker 容器和镜像</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;</p>
<h2 id="articleHeader0" style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif; font-weight: 500; line-height: 1.2; color: rgb(51, 51, 51); margin: 0px; font-size: 1.75em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); padding-bottom: 10px;">删除所有未运行 Docker 容器</h2>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><span class="hljs-title" style="box-sizing: border-box; color: rgb(133, 153, 0);">docker</span>&nbsp;rm $(docker ps -a -q)</code></pre>
<h2 id="articleHeader1" style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif; font-weight: 500; line-height: 1.2; color: rgb(51, 51, 51); margin: 1.5em 0px 0px; font-size: 1.75em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); padding-bottom: 10px;">删除所有 Docker 镜像</h2>
<p style="box-sizing: border-box; margin-top: 1.5em; margin-bottom: 1.5em; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif; line-height: 22.4px;">删除所有未打 tag 的镜像</p>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><span class="hljs-title" style="box-sizing: border-box; color: rgb(133, 153, 0);">docker</span>&nbsp;rmi $(docker images -q | awk&nbsp;<span class="hljs-string" style="box-sizing: border-box; color: rgb(42, 161, 152);">'/^&lt;none&gt;/ { print&nbsp;<span class="hljs-variable" style="box-sizing: border-box; color: rgb(181, 137, 0);">$3</span>&nbsp;}'</span>)</code></pre>
<p style="box-sizing: border-box; margin-top: 1.5em; margin-bottom: 1.5em; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif; line-height: 22.4px;">删除所有镜像</p>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><span class="hljs-title" style="box-sizing: border-box; color: rgb(133, 153, 0);">docker</span>&nbsp;rmi $(docker images -q)</code></pre>
<p style="box-sizing: border-box; margin-top: 1.5em; margin-bottom: 1.5em; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif; line-height: 22.4px;">根据格式删除所有镜像</p>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><span class="hljs-title" style="box-sizing: border-box; color: rgb(133, 153, 0);">docker</span>&nbsp;rm $(docker ps -qf status=exited)</code></pre>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><code class="shell plain" style="margin: 0px 2px; padding: 0px 5px; border-radius: 3px; border: 1px solid rgb(221, 221, 221); line-height: 15.4px; font-size: 14px; color: rgb(0, 0, 0); word-break: break-word; white-space: pre; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; min-height: auto !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;">docker rmi $(docker images --filter dangling=true -q</code></code></pre>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><code class="shell plain" style="margin: 0px 2px; padding: 0px 5px; border-radius: 3px; border: 1px solid rgb(221, 221, 221); line-height: 15.4px; font-size: 14px; color: rgb(0, 0, 0); word-break: break-word; white-space: pre; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; min-height: auto !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-family: 'Microsoft YaHei', Verdana, sans-serif, SimSun; line-height: normal; white-space: normal; background-color: rgb(255, 255, 255);">执行这条命令删除pull过程或者create过程产生的临时镜像，剩下的都是有用的镜像。镜像是一层层叠加起来的，你使用的是带名字和tag的发布镜像,那些中间镜像没有名字,只有哈希,所以叫none。。</span></code></code></pre>
<pre class="hljs nginx" style="box-sizing: border-box; overflow: auto; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.93em; padding: 1em; margin-bottom: 1.5em; line-height: 1.3; word-break: break-all; word-wrap: break-word; color: rgb(101, 123, 131); border: none; border-radius: 3px; max-height: 35em; position: relative; margin-top: 0px !important; background: url(&quot;../img/blueprint.png&quot;) rgb(246, 246, 246);"><code style="box-sizing: border-box; font-family: 'Source Code Pro', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 1em; color: inherit; padding: 0px; border-radius: 0px; white-space: initial; overflow-wrap: normal; word-break: break-word; background: none;"><code class="shell plain" style="margin: 0px 2px; padding: 0px 5px; border-radius: 3px; border: 1px solid rgb(221, 221, 221); line-height: 15.4px; font-size: 14px; color: rgb(0, 0, 0); word-break: break-word; white-space: pre; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; outline: 0px !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; min-height: auto !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-family: 'Microsoft YaHei', Verdana, sans-serif, SimSun; line-height: normal; white-space: normal; background-color: rgb(255, 255, 255);">这个是列出所有的镜像的。因为某些镜像间存在依赖关系。你要知道docker跟git一样，有&ldquo;层&rdquo;的概念。你用docker pull ubuntu的时候就会发现，会pull下来一堆镜像，然后最后一个镜像tag为ubuntu:latest。</span></code></code></pre>]]></description>
			<link>http://meisw.wdlinux.cn//show-850-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2016-12-08 22:37</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-849-1.html</guid>
			<title>Docker 之Dockerfile 快速学习（二）</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span style="color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">Dockerfile文件的说明：</span></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">格式：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">INSTRUCTION arguments</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">虽然指令忽略大小写，但建议用大写</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);"># 是注释</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">MAINTAINER命令：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">MAINTAINER命令用来指定维护者的姓名和联系方式</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">FROM命令：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">FROM &lt;image&gt;/&lt;image&gt;:&lt;tag&gt;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">这个是设置基本的镜像，为后续的命令使用，所以应该作为Dockerfile的第一条指令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">比如：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">FROM centos6-base</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">RUN 命令：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">会上面FROM 指定的镜像里执行任何命令，然后提交（commit）结果，提交的镜像会在后面继续用到</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">格式：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">RUN &lt;command&gt; (这个命令运行一个shell中 - '/bin/sh -c')</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">或：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">RUN [&quot;executable&quot;, &quot;param1&quot;, &quot;param2&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">RUN 命令等价于：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">docker run image_name command</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD &nbsp;and &nbsp;ENTRYPOINT</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">命令设置在容器启动时执行命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT，表示镜像在初始化时需要执行的命令，不可被重写覆盖，需谨记</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD，表示镜像运行默认参数，可被重写覆盖</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT/CMD都只能在文件中存在一次，并且最后一个生效 多个存在，只有最后一个生效，其它无效！</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">需要初始化运行多个命令，彼此之间可以使用 &amp;&amp; 隔开，但最后一个须要为无限运行的命令，需切记！</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT/CMD，一般两者可以配合使用，比如：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT [&quot;/usr/sbin/sshd&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD [&quot;-D&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">** 在Docker　daemon模式下，无论你是使用ENTRYPOINT，还是CMD，最后的命令，一定要是当前进程需要一直运行的，才能够防容器退出。***</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">以下无效方式：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT service tomcat7 start #运行几秒钟之后，容器就会退出</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD service tomcat7 start #运行几秒钟之后，容器就会退出</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">这样有效：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT service tomcat7 start &amp;&amp; tail -f /var/lib/tomcat7/logs/catalina.out</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);"># 或者</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD service tomcat7 start &amp;&amp; tail -f /var/lib/tomcat7/logs/catalina.out</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">这样也有效：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT [&quot;/usr/sbin/sshd&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">CMD [&quot;-D&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">USER 命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">比如指定 memcached 的运行用户，可以使用上面的 ENTRYPOINT or CMD来实现:</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT [&quot;memcached&quot;, &quot;-u&quot;, &quot;daemon&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">更好的方式：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENTRYPOINT [&quot;memcached&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">USER daemon</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">EXPOSE 命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">EXPOSE 命令可以设置一个端口在运行的镜像中暴露在外</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">在docker使用--link来链接两容器时会用到相关端口</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">EXPOSEd &lt;port&gt;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ENV命令：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">用于设置环境变更</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">使用此dockerfile生成的image新建container，可以通过 docker inspect CONTAINER ID &nbsp;看到这个环境变量</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">也可以通过在docker run时设置或修改环境变量</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ADD 命令：</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">从src复制文件到container的dest路径:</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">ADD &lt;src&gt; &lt;dest&gt;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&lt;src&gt; 是相对被构建的源目录的相对路径，可以是文件或目录的路径，也可以是一个远程的文件url</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&lt;dest&gt; 是container中的绝对路径</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">VOLUME 命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">VOLUME [&quot;&lt;mountpoint&gt;&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">如:</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">VOLUME [&quot;/data&quot;]</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">创建一个挂载点用于共享目录</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">WORKDIR 命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">WORKDIR /path/to/workdir</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">配置RUN, CMD, ENTRYPOINT 命令设置当前工作路径</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">可以设置多次，如果是相对路径，则相对前一个 WORKDIR 命令</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">比如:</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">WORKDIR /a WORKDIR b WORKDIR c RUN pwd</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">其实是在 /a/b/c 下执行 pwd</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">&nbsp;</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">Dockerfile文件到此介绍完毕。</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; color: rgb(61, 70, 77); font-family: 'Pingfang SC', STHeiti, 'Lantinghei SC', 'Open Sans', Arial, 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', SimSun, sans-serif; font-size: 16px; line-height: 28px; background-color: rgb(248, 248, 248);">下面是一个完整的Dockerfile文件</p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">#Dockerfile</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">FROM centos6-base</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">MAINTAINER zhou_mfk &lt;zhou_mfk@163.com&gt;</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN ssh-keygen -q -N &quot;&quot; -t dsa -f /etc/ssh/ssh_host_dsa_key</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN ssh-keygen -q -N &quot;&quot; -t rsa -f /etc/ssh/ssh_host_rsa_key</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN sed -ri 's/session &nbsp; &nbsp;required &nbsp; &nbsp; pam_loginuid.so/#session &nbsp; &nbsp;required &nbsp; &nbsp; pam_loginuid.so/g' /etc/pam.d/sshd</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN mkdir -p /root/.ssh &amp;&amp; chown root.root /root &amp;&amp; chmod 700 /root/.ssh</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">EXPOSE 22</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN echo 'root:redhat' | chpasswd</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN yum install -y yum-priorities &amp;&amp; rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm &amp;&amp; rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">RUN yum install tar gzip gcc vim wget -y</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">ENV LANG en_US.UTF-8</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">ENV LC_ALL en_US.UTF-8</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">CMD /usr/sbin/sshd -D</span></font></p>
<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; margin-bottom: 16px; background-color: rgb(248, 248, 248);"><font color="#3d464d" face="Pingfang SC, STHeiti, Lantinghei SC, Open Sans, Arial, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, SimSun, sans-serif"><span style="font-size: 16px; line-height: 28px;">#End</span></font></p>]]></description>
			<link>http://meisw.wdlinux.cn//show-849-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2016-12-08 15:04</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-847-1.html</guid>
			<title>centos下安装docker最新版教程</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<strong style="color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; font-size: 13px; line-height: 19.5px;">1、通过yum安装</strong></p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;">需要root或者能sudo的权限</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
yum包更新到最新<br />
$ sudo yum update</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
添加Docker yum源<br />
$ sudo tee /etc/yum.repos.d/docker.repo &lt;&lt;-'EOF'<br />
[dockerrepo]<br />
name=Docker Repository<br />
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/<br />
enabled=1<br />
gpgcheck=1<br />
gpgkey=https://yum.dockerproject.org/gpg<br />
EOF</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
安装Docker包<br />
$ sudo yum install docker-engine</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
启动Docker守护进程<br />
$ sudo service docker start</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
通过测试镜像运行一个容器来验证Docker是否安装正确<br />
$ sudo docker run hello-world</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
<strong>2、通过脚本安装</strong><br />
需要root或者能sudo的权限</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
yum包更新到最新<br />
$ sudo yum update</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
运行Docker安装脚本<br />
$ curl -sSL https://get.docker.com/ | sh<br />
这个脚本会添加docker.repo仓库并且安装Docker</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
启动Docker守护进程<br />
$ sudo service docker start</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
通过测试镜像运行一个容器来验证Docker是否安装正确<br />
$ sudo docker run hello-world</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
创建一个Docker用户组<br />
docker守护进程绑定在Unix socket 而不是 TCP 端口。默认情况下Unix socket属于root用户和具有sudo权限用户的使用范畴。出于这个原因，docker守护进程需要一直在root用户下面运行。<br />
To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.<br />
为了避免运行docker命令的时候需要使用sudo命令，创建一个叫docker的Unix用户组并将需要运行docker的用户添加进去。当开始运行docker守护进程，会令docker用户组的成员拥有Unix socket的读写权限。<br />
创建docker用户组并添加用户：<br />
1.需要root或者能sudo的权限</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
2.创建docker用户组并添加用户<br />
sudo usermod -aG docker your_username</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
3.退出并且登录到your_username，如果在your_username下也建议退出再重新登录一次，这确保您的用户正在运行正确的权限。</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;"><br />
4.验证运行docker已不再需要sudo命令</p>
<p style="font-size: 13px; margin: 10px auto; color: rgb(75, 75, 75); font-family: verdana, Arial, helvetica, sans-seriff; line-height: 19.5px;">$ docker run hello-world<br />
开机运行docker<br />
$ sudo chkconfig docker on</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-847-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-48-1.html">docker</category>
			<pubDate>2016-12-07 23:31</pubDate>
		</item>
	</channel>
</rss>
