Linux下Docker的安裝及使用

1.背景

類似于電腦,要在朋友的電腦上跑你寫的Java程序,就得檢查他電腦有沒有安裝Java環(huán)境.

類似的,要想在別的電腦上跑你寫的Python程序,又得檢查那臺(tái)電腦有沒有裝python.

如何讓自己寫的程序換到別的電腦上后,可以便捷的運(yùn)行起來?

將程序和程序的環(huán)境打包遷移,是一種解決方案.

  • 為啥不用虛擬機(jī)?

虛擬機(jī)安裝太麻煩,就好比一個(gè)完整的操作系統(tǒng),啟動(dòng)起來很費(fèi)時(shí)間.

所以,你可以簡(jiǎn)單的理解為:Docker就是一個(gè)輕量級(jí)的虛擬機(jī)(只虛擬你需要的軟件運(yùn)行環(huán)境,冗余的一點(diǎn)都不要).

  • 網(wǎng)上看到的另一個(gè)Docker入門網(wǎng)站,還不錯(cuò).

https://docker.easydoc.net/

2.安裝

服務(wù)器版本:CentOS 8.2 64位

2.1 安裝yum-utils

<code-box id="5Jkf7F" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_1 mCS-autoHide" highlighted="true" id="pre-5Jkf7F" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-nYRwi2" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">yum install -y yum-utils</code-pre>

</pre></code-box>

2.2 yum配置阿里Docker源

<code-box id="KDdcjB" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_2 mCS-autoHide" highlighted="true" id="pre-KDdcjB" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-6aTiBE" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo</code-pre>

</pre></code-box>

解決problem with installed package podman-1.6.4-10.的報(bào)錯(cuò)

<code-box id="r7D6F2" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_3 mCS-autoHide" highlighted="true" id="pre-r7D6F2" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-8TbCZ3" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">yum erase podman buildah</code-pre>

</pre></code-box>

解決yum命令報(bào)錯(cuò)問題

CentOS 8 EOL如何切換源?

[圖片上傳失敗...(image-7e83a5-1663643704610)]

2.3 安裝Docker

<code-box id="XyBS3C" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_4 mCS-autoHide" highlighted="true" id="pre-XyBS3C" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-6ERPkZ" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># docker的三個(gè)組件: docker-ce、docker-ce-cli、containerd.io

--nobest不只使用最佳選擇的軟件包 --skip-broken跳過無法安裝的軟件包

yum install -y docker-ce docker-ce-cli containerd.io --nobest</code-pre>

</pre></code-box>

2.4 查看Docker版本

<code-box id="GHQXhy" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_5 mCS-autoHide" highlighted="true" id="pre-GHQXhy" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-tNcEpj" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 簡(jiǎn)單信息
docker -v

查看docker的版本號(hào),包括客戶端、服務(wù)端、依賴的Go等

docker version

查看系統(tǒng)(docker)層面信息,包括管理的images, containers數(shù)等

docker info</code-pre>

</pre></code-box>

2.5 擴(kuò)展

1.為啥安裝yum-utils?

為了使用yum-config-manager命令, 執(zhí)行--add-repo操作.

2.添加阿里docker源干嘛?

在最開始的時(shí)候,我們的yum倉庫里的docker安裝包是上面的幾個(gè),執(zhí)行了yum源添加后,阿里帶過來了新的docker安裝包。

[圖片上傳失敗...(image-4253f4-1663643704610)]

3.阿里鏡像站

阿里鏡像站

Docker-CE介紹

01.png

4.docker三個(gè)組件的區(qū)別

containerd.io、docker-ce-cli、docker-ce的區(qū)別

3.Docker服務(wù)相關(guān)

3.1 啟動(dòng)

<code-box id="wWcMhm" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_6 mCS-autoHide" highlighted="true" id="pre-wWcMhm" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-hTKaXn" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 啟動(dòng)
systemctl start docker

開機(jī)自啟

systemctl enable docker

禁用開機(jī)自啟

systemctl disable docker

docker服務(wù)是否開機(jī)自啟

systemctl is-enabled docker

已啟動(dòng)的服務(wù)列表

systemctl list-unit-files|grep enabled</code-pre>

</pre></code-box>

3.2 停止

<code-box id="JtanTr" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_7 mCS-autoHide" highlighted="true" id="pre-JtanTr" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-hCzh6T" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">systemctl stop docker</code-pre>

</pre></code-box>

3.3 重啟

<code-box id="bZJAaZ" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_8 mCS-autoHide" highlighted="true" id="pre-bZJAaZ" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-zrybGY" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">systemctl restart docker</code-pre>

</pre></code-box>

3.4 查看docker狀態(tài)

<code-box id="ndxF8K" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_9 mCS-autoHide" highlighted="true" id="pre-ndxF8K" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-W6fxQW" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">systemctl status docker</code-pre>

</pre></code-box>

4.Docker主要概念

類比win

鏡像: 程序安裝包

容器: 安裝好的程序

(鏡像的)倉庫: 放安裝包的倉庫.

4.1 倉庫、鏡像和容器

  • 鏡像

    程序安裝包

    Docker鏡像里包含了已打包的應(yīng)用程序及其所依賴的環(huán)境。它包含應(yīng)用程序可用的文件系統(tǒng)和其他元數(shù)據(jù),如鏡像運(yùn)行時(shí)的可執(zhí)行文件路徑。

  • 鏡像倉庫

    安裝包的倉庫

    Docker鏡像倉庫用于存放Docker鏡像,以及促進(jìn)不同人和不同電腦之間共享這些鏡像。當(dāng)編譯鏡像時(shí),要么可以在編譯它的電腦上運(yùn)行,要么可以先上傳鏡像到一個(gè)鏡像倉庫,然后下載到另外一臺(tái)電腦上并運(yùn)行它。某些倉庫是公開的,允許所有人從中拉取鏡像,同時(shí)也有一些是私有的,僅部分人和機(jī)器可接入。

  • 容器

    安裝好的軟件

    Docker容器通常是一個(gè)Linux容器,它基于Docker鏡像被創(chuàng)建。一個(gè)運(yùn)行中的容器是一個(gè)運(yùn)行在Docker主機(jī)上的進(jìn)程,但它和主機(jī),以及所有運(yùn)行在主機(jī)上的其他進(jìn)程都是隔離的。這個(gè)進(jìn)程也是資源受限的,意味著它只能訪問和使用分配給它的資源(CPU、內(nèi)存等)。

4.2 打包、分發(fā)和部署

  • 打包

    制作鏡像

    把你軟件本身、所需要的依賴、三方庫等制作成一個(gè)"安裝包"

  • 分發(fā)

    上傳鏡像倉庫

    將安裝包上傳到軟件倉庫,別人可以方便的下載和安裝

  • 部署

    啟動(dòng)鏡像,獲得運(yùn)行著的容器.win開發(fā)好后.

    拿著下載好的安裝包,用命令行運(yùn)行起來(安裝包中帶著運(yùn)行環(huán)境)

4.3 一個(gè)簡(jiǎn)單的流程

4.2.1 開發(fā)者在開發(fā)環(huán)境(本地機(jī)器)開發(fā)好應(yīng)用后,制作出鏡像。

Docker執(zhí)行命令,在本地機(jī)器構(gòu)建出鏡像并存儲(chǔ)。

4.2.2 開發(fā)者執(zhí)行上傳鏡像命令,上傳本地鏡像到鏡像倉庫.

Docker收到命令后,將本地鏡像上傳到鏡像倉庫。

4.2.3 開發(fā)者向生產(chǎn)環(huán)境(遠(yuǎn)端服務(wù)器)發(fā)送運(yùn)行鏡像命令.

生產(chǎn)環(huán)境服務(wù)器收到命令后,Docker會(huì)從鏡像倉庫拉取鏡像,然后基于鏡像運(yùn)行容器。

20210420095024.jpeg

5.鏡像相關(guān)

類比win: 程序的安裝包

官方鏡像倉庫

Docker鏡像(image)詳解

5.1 查看鏡像

<code-box id="X2PBcr" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_10 mCS-autoHide" highlighted="true" id="pre-X2PBcr" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-ybrney" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker images</code-pre>

</pre></code-box>

5.2 搜索鏡像

<code-box id="mTyms4" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_11 mCS-autoHide" highlighted="true" id="pre-mTyms4" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-5hFw3d" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker search 鏡像名稱</code-pre>

</pre></code-box>

5.3 拉取鏡像

<code-box id="aKDzc8" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_12 mCS-autoHide" highlighted="true" id="pre-aKDzc8" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-yd6eXW" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker pull 鏡像名稱:版本號(hào)</code-pre>

</pre></code-box>

5.4 刪除鏡像

<code-box id="X46AGC" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_13 mCS-autoHide" highlighted="true" id="pre-X46AGC" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-MM874w" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker rmi 鏡像名稱:版本號(hào)</code-pre>

</pre></code-box>

5.5 其他

5.5.1 鏡像信息

<code-box id="dmNy2a" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_14 mCS-autoHide" highlighted="true" id="pre-dmNy2a" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-TM6Rm3" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">vim /var/lib/docker/image/overlay2/repositories.json</code-pre>

</pre></code-box>

[圖片上傳失敗...(image-1a5d2d-1663643704609)]

repositories.json文件中保存了一些基本信息

[圖片上傳失敗...(image-183c9b-1663643704609)]

6.容器相關(guān)

類比win: 已經(jīng)安裝好的程序

6.1 查看容器列表

<code-box id="sjfz7Y" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_15 mCS-autoHide" highlighted="true" id="pre-sjfz7Y" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-JER5xG" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 查看正在運(yùn)行的容器
docker ps

查看所有容器

docker ps -a</code-pre>

</pre></code-box>

6.2 創(chuàng)建容器

容器創(chuàng)建后,在容器列表中即可看到該容器(相當(dāng)于安裝好程序)

以后用后文的啟、停、刪就可以操作該容器了.

<code-box id="J87Y6P" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_16 mCS-autoHide" highlighted="true" id="pre-J87Y6P" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-n5JF5w" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># eg: \是換行的意思
docker run -d -p 1337:1337
--network kong-net
--name konga
-e "NODE_ENV=production"
-e "DB_ADAPTER=postgres"
-e "DB_URI=postgresql://kong:kong@172.0.0.1:5432/konga"
pantsel/konga</code-pre>

</pre></code-box>


linux中-和--的區(qū)別?

-后面一般跟簡(jiǎn)寫,大多數(shù)是一個(gè)字母,如:

<code-box id="2ApHdh" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_17 mCS-autoHide" highlighted="true" id="pre-2ApHdh" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-b8A2H8" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">ls -l</code-pre>

</pre></code-box>

--后面一般跟長(zhǎng)的完整名字,如:

<code-box id="tpzseK" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_18 mCS-autoHide" highlighted="true" id="pre-tpzseK" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-EdfSFz" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">chkconfig --add</code-pre>

</pre></code-box>


run參數(shù)

  • -rm

    在容器退出時(shí)自動(dòng)清理容器內(nèi)部的文件系統(tǒng)

    在Docker容器退出時(shí),默認(rèn)容器內(nèi)部的文件系統(tǒng)仍然被保留,以方便調(diào)試并保留用戶數(shù)據(jù).

    但是,對(duì)于前臺(tái)運(yùn)行的容器,由于其只是在開發(fā)調(diào)試過程中短期運(yùn)行,其用戶數(shù)據(jù)并無保留的必要.

    啟動(dòng)時(shí)設(shè)置-rm選項(xiàng),這樣在容器退出時(shí)就能夠自動(dòng)清理容器內(nèi)部的文件系統(tǒng).

  • -i

    保持容器運(yùn)行

  • -p

    端口映射

  • -e

    傳遞環(huán)境變量

  • -t

    為容器重新分配一個(gè)偽輸入終端

  • -d

    以守護(hù)進(jìn)程模式運(yùn)行容器,退出后容器不會(huì)停止

  • -it

    創(chuàng)建一個(gè)交互式容器,推出后容器容器停止運(yùn)行

  • -id

    創(chuàng)建一個(gè)守護(hù)容器;退出后容器不停止運(yùn)行

  • –-name

    為創(chuàng)建的容器命名

6.3 進(jìn)入容器

<code-box id="C8bwRe" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_19 mCS-autoHide" highlighted="true" id="pre-C8bwRe" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-7cRjhh" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker exec -it 容器名稱 /bin/bash

eg:進(jìn)入一個(gè)叫konga的容器

docker exec -it konga /bin/bash

在容器中執(zhí)行了一個(gè)ping命令

ping 127.0.0.1

退出當(dāng)前容器

exit</code-pre>

</pre></code-box>

6.4 啟動(dòng)容器

<code-box id="ZwBccE" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_20 mCS-autoHide" highlighted="true" id="pre-ZwBccE" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-Gn8EEz" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker start 容器名稱</code-pre>

</pre></code-box>

6.5 停止容器

<code-box id="4whFZF" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_21 mCS-autoHide" highlighted="true" id="pre-4whFZF" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-kyrPX5" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker stop 容器名稱</code-pre>

</pre></code-box>

6.6 刪除容器

<code-box id="icP7XA" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_22 mCS-autoHide" highlighted="true" id="pre-icP7XA" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-QwDTtc" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker rm 容器名稱

刪除所有容器

docker rm docker ps -aq</code-pre>

</pre></code-box>

6.7 查看容器詳細(xì)信息

inspect 視察、檢查

<code-box id="7xEX4m" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_23 mCS-autoHide" highlighted="true" id="pre-7xEX4m" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-mFDYTX" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker inspect 容器名稱</code-pre>

</pre></code-box>

6.8 其他

6.8.1 容器文件位置

<code-box id="frNNH5" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_24 mCS-autoHide" highlighted="true" id="pre-frNNH5" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-Zh2ynt" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">cd /var/lib/docker/containers</code-pre>

</pre></code-box>

[圖片上傳失敗...(image-c33118-1663643704607)]

查看所有容器,其中的id:eb67258c80d1與上方文件夾對(duì)應(yīng)

<code-box id="WHmSs6" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_25 mCS-autoHide" highlighted="true" id="pre-WHmSs6" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-dXzpzw" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker ps -a

顯示

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eb67258c80d1 mongo "docker-entrypoint.s…" 7 days ago Exited (0) 6 days ago mongo</code-pre>

</pre></code-box>

6.8.2 從容器里拷貝文件(出來到)宿主機(jī)

手動(dòng)拷貝,后面可以使用-v命令直接掛載(映射)數(shù)據(jù)。

<code-box id="TDmCm5" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_26 mCS-autoHide" highlighted="true" id="pre-TDmCm5" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-wCsWaQ" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker cp CONTAINERID:/path/file.type /home

eg: 拷貝eb67258c80d1中的/home/test.txt到宿主機(jī)的/home文件夾下

docker cp eb67258c80d1:/home/test.txt /home

容器停止了也可以拷貝,只要容器還在,容器里面的文件就也還在.</code-pre>

</pre></code-box>

7.網(wǎng)絡(luò)相關(guān)

容器可以比擬做一個(gè)獨(dú)立的系統(tǒng)環(huán)境,能配置自己網(wǎng)絡(luò),所以說容器里的localhost不一定等于宿主機(jī)的localhost

網(wǎng)絡(luò)模式

  • bridge:橋接docker(默認(rèn)創(chuàng)建時(shí),不指定網(wǎng)絡(luò)驅(qū)動(dòng),將使用bridge模式)

  • none:不配置網(wǎng)絡(luò)

  • host:和宿主機(jī)共享網(wǎng)絡(luò)

    例如:當(dāng)你在容器上使用80端口訪問其他應(yīng)用,使用的是宿主機(jī)的80端口.

  • container:容器網(wǎng)絡(luò)連通(用的少,局限很大)

Linux查看網(wǎng)絡(luò)信息

<code-box id="tQBa8m" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_27 mCS-autoHide" highlighted="true" id="pre-tQBa8m" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-66Ewwc" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># if沒有打錯(cuò).

這里面能看到docker相關(guān)的網(wǎng)絡(luò).

ifconfig</code-pre>

</pre></code-box>

7.1 查看docker下的網(wǎng)絡(luò)列表

<code-box id="mPsG4B" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_28 mCS-autoHide" highlighted="true" id="pre-mPsG4B" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-BexXN4" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker network ls</code-pre>

</pre></code-box>

7.2 查看單個(gè)網(wǎng)絡(luò)詳細(xì)信息

<code-box id="ZnWcrC" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_29 mCS-autoHide" highlighted="true" id="pre-ZnWcrC" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-ZZQ7yb" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker network inspect networkname</code-pre>

</pre></code-box>

7.3 創(chuàng)建網(wǎng)絡(luò)

<code-box id="nTxz2z" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_30 mCS-autoHide" highlighted="true" id="pre-nTxz2z" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-zQdeWc" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 不指定網(wǎng)絡(luò)驅(qū)動(dòng)時(shí),默認(rèn)創(chuàng)建的是bridge網(wǎng)絡(luò).
docker network create networkname</code-pre>

</pre></code-box>

7.4 刪除網(wǎng)絡(luò)

<code-box id="K2Hc2Y" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_31 mCS-autoHide" highlighted="true" id="pre-K2Hc2Y" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-SrktPd" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker network rm networkname</code-pre>

</pre></code-box>

8.日志相關(guān)

<code-box id="JGJ5ep" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_32 mCS-autoHide" highlighted="true" id="pre-JGJ5ep" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-PMzAmS" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">docker logs [OPTIONS] CONTAINER

Options參數(shù)

--details: 顯示更多的信息
--follow(-f): 跟蹤實(shí)時(shí)日志
--since string: 顯示自某個(gè)timestamp之后的日志,或相對(duì)時(shí)間,如40m(即40分鐘)
--tail string: 從日志末尾顯示多少行日志, 默認(rèn)是all
--timestamps(-t): 顯示時(shí)間戳
--until string: 顯示自某個(gè)timestamp之前的日志,或相對(duì)時(shí)間,如40m(即40分鐘</code-pre>

</pre></code-box>

示例

<code-box id="b5AYj4" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_33 mCS-autoHide" highlighted="true" id="pre-b5AYj4" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-MZc35e" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 查看容器mysql 最近30分鐘的日志:
docker logs --since 30m mysql

查看容器mysql 某時(shí)間之后的日志:

docker logs -t --since="2019-11-02T13:23:37" mysql

查看容器mysql 某時(shí)間段日志:

docker logs -t --since="2019-11-02T13:23:37" --until "2019-11-03T12:23:37" mysql</code-pre>

</pre></code-box>

9.配置國(guó)內(nèi)加速

9.1 手動(dòng)修改

<code-box id="ytY4hH" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_34 mCS-autoHide" highlighted="true" id="pre-ytY4hH" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-hhYJ7H" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">vim /etc/docker/daemon.json

加入鏡像信息,注意不要有這行注釋,json是不支持注釋的,不然啟動(dòng)會(huì)報(bào)錯(cuò)

{
"registry-mirrors" : [
"https://mirror.ccs.tencentyun.com",
"http://registry.docker-cn.com",
"http://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug" : true,
"experimental" : true
}</code-pre>

</pre></code-box>

重啟docker

<code-box id="PXjzB4" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_35 mCS-autoHide" highlighted="true" id="pre-PXjzB4" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-GK85Zd" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">systemctl restart docker.service</code-pre>

</pre></code-box>

鏡像說明

<code-box id="6MPfsk" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_36 mCS-autoHide" highlighted="true" id="pre-6MPfsk" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-Nxkmzt" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);">"https://mirror.ccs.tencentyun.com" //騰訊
"http://registry.docker-cn.com" //docker官方提供的中國(guó)鏡像
"http://docker.mirrors.ustc.edu.cn" //中國(guó)科學(xué)技術(shù)大學(xué)
"http://hub-mirror.c.163.com" //網(wǎng)易</code-pre>

</pre></code-box>

9.2 DaoCloud鏡像站

幫助文檔

Linux

<code-box id="x7iFYM" style="padding: 0px; margin: 0px; color: rgb(34, 34, 34); font-family: -apple-system, "SF UI Text", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; font-size: 15.5px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgba(255, 255, 255, 0.9); text-decoration-style: initial; text-decoration-color: initial; position: relative; display: block;"><pre class="highlighter-hljs mCustomScrollbar _mCS_37 mCS-autoHide" highlighted="true" id="pre-x7iFYM" style="padding: 10px !important; margin: 5px 0px; transition-duration: 0.2s; transition-property: color, opacity, padding-top, padding-bottom, margin-top, margin-bottom, height; overflow: visible; touch-action: pinch-zoom; font-size: 14px !important; font-weight: 400; font-family: "Ubuntu Mono", monospace !important; white-space: pre; overflow-wrap: break-word; border-radius: 4px !important; word-break: break-all; counter-reset: itemcounter 0; color: rgb(0, 0, 0); background-color: rgb(246, 248, 250); position: relative;">

<code-pre class="code-pre code-pre-line" id="pre-fcSMKW" style="padding: 0px 0px 0px 10px; margin: 0px; position: relative; display: block; left: 30px; border-left: 1px solid rgb(153, 153, 153);"># 下載sh腳本 手動(dòng)下載瀏覽器訪問: https://get.daocloud.io/daotools/set_mirror.sh</code-pre>

</pre></code-box>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容