<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>docker - 广联在线</title>
	<atom:link href="https://www.abvnet.com/tag/docker/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.abvnet.com</link>
	<description>Abvnet</description>
	<lastBuildDate>Sun, 28 Nov 2021 12:21:23 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://www.abvnet.com/wp-content/uploads/2021/07/A-100x100.png</url>
	<title>docker - 广联在线</title>
	<link>https://www.abvnet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Docker的安装和使用——初学者快速上手</title>
		<link>https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/</link>
					<comments>https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 20 Nov 2021 08:41:12 +0000</pubDate>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[docker]]></category>
		<guid isPermaLink="false">https://www.abvnet.com/?p=1275</guid>

					<description><![CDATA[<p>转载自广联在线微信公众号。请扫描本页底部二维码关注和查看原文。 Docker 是一款非常强大又易用的容器管理工&#8230;&#160;<a href="https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/" rel="bookmark">阅读更多 &#187;<span class="screen-reader-text">Docker的安装和使用——初学者快速上手</span></a></p>
<p>The post <a href="https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/">Docker的安装和使用——初学者快速上手</a> first appeared on <a href="https://www.abvnet.com">广联在线</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>转载自广联在线微信公众号。请扫描本页底部二维码关注和查看原文。</p>
<p>Docker 是一款非常强大又易用的容器管理工具。使用Docker，可以像VM一样为应用程序提供一个隔离的运行环境，但又不像VM那样占用很多系统资源。事实上，配合docker-compose工具，一个现成Docker容器的配置和启动可以在几十秒内完成，用户通常不需要关心OS和支撑软件的安装和配置。更重要的是，Docker是开源、免费（CE版）和跨平台的。你可以在Linux、Windows和macOS之间任意选择。下面用在 CentOS 7 上使用 Docker 部署 MySQL 服务器为例，说明一下 Docker 的安装和使用过程。</p>
<p><img decoding="async" src="http://www.abvnet.com/wp-content/uploads/2021/11/frc-68d1f0ef49e5aaaf29a3d4b245af10a9.png"></p>
<p>其实现在新的 CentOS 已经不默认带有 Docker 的源了，代之以 Podman。Podman 的用法和作用跟 Docker 非常相似，但我们在这里还是先讨论更常用的 Docker。熟悉 Docker 的朋友们如果有兴趣，可以读一下 Podman 的使用说明，相信不用花太多时间就可以上手。</p>
<p>&nbsp;</p>
<p>在 CentOS 7上安装Docker 环境：</p>
<p>&nbsp;</p>
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li style="list-style-type: none;">
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li>&nbsp; 添加 Docker 源：</li>
</ol>
</li>
</ol>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">$ <span style="color: #0000ff; line-height: 1.5 !important;">sudo</span> <span style="color: #0000ff; line-height: 1.5 !important;">yum</span> <span style="color: #0000ff; line-height: 1.5 !important;">install</span> -y <span style="color: #0000ff; line-height: 1.5 !important;">yum</span>-utils device-mapper-persistent-data lvm2</pre>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;"><span style="color: #0000ff; line-height: 1.5 !important;"><span style="color: #000000; line-height: 1.5 !important;">$</span> sudo</span> <span style="color: #0000ff; line-height: 1.5 !important;">yum</span>-config-manager --add-repo</pre>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">https:<span style="color: #008000; line-height: 1.5 !important;">//download.docker.com/linux/centos/docker-ce.repo</span></pre>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;"><span style="color: #008000; line-height: 1.5 !important;">&nbsp;</span></pre>
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li style="list-style-type: none;">
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li>&nbsp; 安装：</li>
</ol>
</li>
</ol>
<pre style="overflow: auto; overflow-wrap: break-word; font-family: 'Courier New' !important;">$ <span style="color: #0000ff; line-height: 1.5 !important;">sudo</span> <span style="color: #0000ff; line-height: 1.5 !important;">yum</span> <span style="color: #0000ff; line-height: 1.5 !important;">install</span> docker-ce</pre>
<pre style="overflow: auto; overflow-wrap: break-word; font-family: 'Courier New' !important;">&nbsp;</pre>
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li style="list-style-type: none;">
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li>&nbsp;加入开机自启动：</li>
</ol>
</li>
</ol>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">$ <span style="color: #0000ff; line-height: 1.5 !important;">sudo</span><span style="line-height: 1.5 !important;"> systemctl start docker
$ </span><span style="color: #0000ff; line-height: 1.5 !important;">sudo</span> systemctl enable docker</pre>
<p>&nbsp;</p>
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li style="list-style-type: none;">
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li>安装 docker-compose 工具</li>
</ol>
</li>
</ol>
<p style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">$ <span style="color: #0000ff; line-height: 1.5 !important;">sudo</span> curl -L &#8220;https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)&#8221; -o /usr/local/bin/docker-compose</p>
<p style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">$ <span style="color: #0000ff; line-height: 1.5 !important;">sudo</span> chmod +x /usr/local/bin/docker-compose</p>
<pre style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;"><span style="color: #333333; font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif; font-size: 17px; text-align: justify;">&nbsp;</span></pre>
<p>下面用 docker-compose 工具来部署MySQL:</p>
<p>&nbsp;</p>
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li style="list-style-type: none;">
<ol class="list-paddingleft-2" style="width: 577.422px; white-space: normal;">
<li>在你的 home 中自建一个目录用来保存 yaml 文件。
<p style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">$&nbsp;<span style="color: #0000ff; line-height: 1.5 !important;">cd</span>&nbsp;~ &amp;&amp;&nbsp;mkdir mysql_docker</p>
<p style="overflow: auto; overflow-wrap: break-word; font-size: 12px; color: #000000; text-align: start; font-family: 'Courier New' !important;">&nbsp;</p>
</li>
<li>用 vi 工具编辑生成一个 docker-compose.yml 文件，内容参考下图：<span style="color: #000000; font-family: 'Courier New'; font-size: 12px; text-align: start;">$&nbsp;</span><span style="font-family: 'Courier New'; font-size: 12px; text-align: start; color: #0000ff; line-height: 1.5 !important;">vim</span><span style="color: #000000; font-family: 'Courier New'; font-size: 12px; text-align: start;">&nbsp;docker-compose.yml</span>
<p>&nbsp;</p>
<p style="text-align: center;"><img decoding="async" src="http://www.abvnet.com/wp-content/uploads/2021/11/frc-fd57c92b26dc44905285168fe2232e90.png"></p>
<p style="text-align: center;">&nbsp;</p>
</li>
<li>自动下载镜像并启动容器<span style="color: #000000; font-family: 'Courier New'; font-size: 12px; text-align: start;">$&nbsp;</span><span style="font-family: 'Courier New'; font-size: 12px; text-align: start; color: #0000ff; line-height: 1.5 !important;">sudo</span><span style="color: #000000; font-family: 'Courier New'; font-size: 12px; text-align: start;">&nbsp;docker-compose up -d</span><br />
<section></section>
</li>
<li>自测。可以用 docker ps 检查容器启动情况， netstat -ntlp 查看 3306 端口的占用情况，也可以直接用 mysql 命令行来测试数据库登录和连接。</li>
</ol>
</li>
</ol>
<section>&nbsp;&nbsp;</p>
</section>
<p>这样，MySQL 服务器就在本机3306端口搭建好了。只需要建立一个 yaml 文件再运行 docker-compose，这跟在 CentOS 上从代码安装配置MySQL服务器比起来，是不是简单多了？接下来你可以用数据库客户端来测试它，这里就不展开了。如果有疑问请直接私信，需要的话以后可以另写一篇来讲解。</p>
<p>&nbsp;</p><p>The post <a href="https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/">Docker的安装和使用——初学者快速上手</a> first appeared on <a href="https://www.abvnet.com">广联在线</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.abvnet.com/docker%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8-%e5%88%9d%e5%ad%a6%e8%80%85%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
