<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Devops on ChengAo Shen</title>
    <link>https://chengaoshen.com/zh/tags/devops/</link>
    <description>Recent content in Devops on ChengAo Shen</description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Wed, 30 Dec 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://chengaoshen.com/zh/tags/devops/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>🐳Docker Basic(Chinese)</title>
      <link>https://chengaoshen.com/zh/posts/docker-basicchinese/</link>
      <pubDate>Wed, 30 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://chengaoshen.com/zh/posts/docker-basicchinese/</guid>
      <description>&lt;h2 id=&#34;一doker快速使用&#34;&gt;&#xA;  一、Doker快速使用&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e4%b8%80doker%e5%bf%ab%e9%80%9f%e4%bd%bf%e7%94%a8&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;11-构建一个容器&#34;&gt;&#xA;  1.1 构建一个容器&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#11-%e6%9e%84%e5%bb%ba%e4%b8%80%e4%b8%aa%e5%ae%b9%e5%99%a8&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;拉取并使用docker的ubuntu镜像构建一个&lt;strong&gt;交互式&lt;/strong&gt;的容器。&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo docker run --name containerName -i -t ubuntu /bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;参数解释：&lt;/p&gt;&#xA;&lt;p&gt;``&amp;ndash;name`是对于容器的命名&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;-i&lt;/code&gt;保证容器的STDIN开启，保证持续的标准输入；&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;-t&lt;/code&gt;为docker为容器分配一个tty终端&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;ubuntu&lt;/code&gt;提供的是镜像名，先从本机查找之后，若无则去dockerHub上查找&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;/bin/bash&lt;/code&gt;告知容器需要运行的命令&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;12-关闭容器与查看&#34;&gt;&#xA;  1.2 关闭容器与查看&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#12-%e5%85%b3%e9%97%ad%e5%ae%b9%e5%99%a8%e4%b8%8e%e6%9f%a5%e7%9c%8b&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;在容器内键入&lt;code&gt;exit&lt;/code&gt;可以退出容器，之后在宿主机上可以通过使用&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;docker ps -a&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;来查看所拥有的全部容器。&lt;/p&gt;&#xA;&lt;h3 id=&#34;13-启动并附着到容器&#34;&gt;&#xA;  1.3 启动并附着到容器&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#13-%e5%90%af%e5%8a%a8%e5%b9%b6%e9%99%84%e7%9d%80%e5%88%b0%e5%ae%b9%e5%99%a8&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;当知道容器的名字或者uuid的时候可以使用&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-shell&#34; data-lang=&#34;shell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo docker start containerName&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sudo docker start UUID&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;来重新运行容器，重新运行的容器会沿用&lt;code&gt;docker run&lt;/code&gt;时候的命令，此时我们可以使用&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
