庭前落尽梧桐 發表於 2025-7-15 17:21:00

Deepin 23.10安装Docker - 指南

<style>pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", monospace !important; font-size: 14px !important; line-height: 1.6 !important; padding: 16px !important; margin: 16px 0 !important; background-color: rgba(248, 248, 248, 1) !important; border: 1px solid rgba(225, 228, 232, 1) !important; border-radius: 6px !important; tab-size: 4 !important; -moz-tab-size: 4 !important; max-width: 100% !important; box-sizing: border-box !important }
code { font-family: "Consolas", "Monaco", "Courier New", monospace !important; font-size: 14px !important; white-space: pre !important; word-wrap: normal !important; word-break: normal !important; overflow-wrap: normal !important; display: inline !important; background: rgba(0, 0, 0, 0) !important; border: none !important; padding: 0 !important; margin: 0 !important; line-height: inherit !important }
pre code { background: rgba(0, 0, 0, 0) !important; border: 0 !important; border-radius: 0 !important; display: block !important; line-height: 1.6 !important; margin: 0 !important; max-width: none !important; overflow: visible !important; padding: 0 !important; white-space: pre !important; word-wrap: normal !important; word-break: normal !important; color: inherit !important }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: rgba(112, 128, 144, 1) !important; font-style: italic !important }
.token.punctuation { color: rgba(153, 153, 153, 1) !important }
.token.atrule, .token.attr-value, .token.keyword { color: rgba(0, 119, 170, 1) !important; font-weight: bold !important }
.token.function, .token.class-name { color: rgba(221, 74, 104, 1) !important; font-weight: bold !important }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: rgba(102, 153, 0, 1) !important }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: rgba(153, 0, 85, 1) !important }
.cnblogs-markdown pre, .cnblogs-post-body pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; background-color: rgba(248, 248, 248, 1) !important; border: 1px solid rgba(225, 228, 232, 1) !important; border-radius: 6px !important; padding: 16px !important; margin: 16px 0 !important }
pre, pre, pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important }</style>
      
<style>pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", monospace !important; font-size: 14px !important; line-height: 1.6 !important; padding: 16px !important; margin: 16px 0 !important; background-color: rgba(248, 248, 248, 1) !important; border: 1px solid rgba(225, 228, 232, 1) !important; border-radius: 6px !important; tab-size: 4 !important; -moz-tab-size: 4 !important; max-width: 100% !important; box-sizing: border-box !important }
code { font-family: "Consolas", "Monaco", "Courier New", monospace !important; font-size: 14px !important; white-space: pre !important; word-wrap: normal !important; word-break: normal !important; overflow-wrap: normal !important; display: inline !important; background: rgba(0, 0, 0, 0) !important; border: none !important; padding: 0 !important; margin: 0 !important; line-height: inherit !important }
p code, li code, td code, h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { background-color: rgba(27, 31, 35, 0.05) !important; border-radius: 3px !important; font-size: 85% !important; margin: 0 !important; padding: 0.2em 0.4em !important; white-space: nowrap !important; font-family: "Consolas", "Monaco", "Courier New", monospace !important }
pre code { background: rgba(0, 0, 0, 0) !important; border: 0 !important; border-radius: 0 !important; display: block !important; line-height: 1.6 !important; margin: 0 !important; max-width: none !important; overflow: visible !important; padding: 0 !important; white-space: pre !important; word-wrap: normal !important; word-break: normal !important; color: inherit !important }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: rgba(112, 128, 144, 1) !important; font-style: italic !important }
.token.punctuation { color: rgba(153, 153, 153, 1) !important }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: rgba(153, 0, 85, 1) !important }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: rgba(102, 153, 0, 1) !important }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: rgba(154, 110, 58, 1) !important }
.token.atrule, .token.attr-value, .token.keyword { color: rgba(0, 119, 170, 1) !important; font-weight: bold !important }
.token.function, .token.class-name { color: rgba(221, 74, 104, 1) !important; font-weight: bold !important }
.token.regex, .token.important, .token.variable { color: rgba(238, 153, 0, 1) !important }
.language-javascript .token.keyword { color: rgba(0, 0, 255, 1) !important; font-weight: bold !important }
.language-javascript .token.string { color: rgba(0, 128, 0, 1) !important }
.language-javascript .token.number { color: rgba(0, 102, 204, 1) !important }
.language-javascript .token.operator { color: rgba(102, 102, 102, 1) !important }
.language-javascript .token.function { color: rgba(121, 85, 72, 1) !important; font-weight: bold !important }
.language-javascript .token.class-name { color: rgba(46, 125, 50, 1) !important; font-weight: bold !important }
.language-bash .token.function { color: rgba(0, 102, 204, 1) !important }
.language-bash .token.string { color: rgba(0, 128, 0, 1) !important }
.language-bash .token.keyword { color: rgba(0, 0, 255, 1) !important; font-weight: bold !important }
.token { display: inline !important; white-space: inherit !important }
.pre-numbering, .hljs-button, .opt-box, .hide-preCode-box { display: none !important }
.markdown_views pre, #content_views pre, .htmledit_views pre, .prettyprint, .hljs { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; font-family: "Consolas", "Monaco", "Courier New", monospace !important }
.language-javascript, .language-java, .language-python, .language-bash, .language-css, .language-html { white-space: pre !important; word-wrap: normal !important; font-family: "Consolas", "Monaco", "Courier New", monospace !important }
.cnblogs-markdown pre, .cnblogs-post-body pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; background-color: rgba(248, 248, 248, 1) !important; border: 1px solid rgba(225, 228, 232, 1) !important; border-radius: 6px !important; padding: 16px !important; margin: 16px 0 !important }
pre, pre, pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important }
pre, pre * { box-sizing: border-box !important }
@media (max-width: 768px) { pre { font-size: 12px !important; padding: 12px !important; overflow-x: auto !important } }</style><div id="content_views" class="htmledit_views atom-one-dark"><p>个人博客地址:Deepin 23.10安装Docker | 一张假钞的真实世界</p><p>Deepin 是基于 Debian 的国产 <span class="words-blog hl-git-1" data-tit="Linux" data-pretit="linux">Linux</span> 发行版,安装 Docker Desktop 可能会遇到兼容性问题,因为 Docker Desktop 官方主要支持 Ubuntu/Debian/Red Hat/Fedora/Arch 等主流发行版,所以选择安装 Docker Engine。</p><ul><li>卸载旧版本(如有)</li></ul>
<pre data-index="0" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-lua">sudo apt remove docker.io docker-doc docker-compose podman-docker containerd runc</code></pre>
<ul><li>安装依赖</li></ul>
<pre data-index="1" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-sql">sudo apt updatesudo apt install -y ca-certificates curl gnupg lsb-release</code></pre>
<ul><li>添加 Docker 官方 GPG 密钥</li></ul>
<pre data-index="2" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-cobol">sudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg</code></pre>
<ul><li>添加 Docker 源</li></ul><p>由于 Deepin 基于 Debian,可以使用 Debian 的 <span class="words-blog hl-git-1" data-tit="Docker" data-pretit="docker">Docker</span> 源(需匹配 Deepin 版本对应的 Debian 版本)。</p><p>查看Deepin对应的Debian版本:</p>
<pre data-index="3" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-bash">$ cat /etc/debian_versionbookworm/sid</code></pre>
<p>执行以下命令添加 Docker 源:</p>
<pre data-index="4" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-cobol">echo "deb https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null</code></pre>
<ul><li>安装 Docker Engine</li></ul>
<pre data-index="5" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-sql">sudo apt updatesudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin</code></pre>
<ul><li>启动 Docker</li></ul>
<pre data-index="6" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-sql">sudo systemctl enable --now docker</code></pre>
<ul><li>允许普通用户运行 Docker</li></ul>
<pre data-index="7" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-php">sudo usermod -aG docker $USERnewgrp docker# 重新加载用户组</code></pre>
<blockquote><p>可能需要重启电脑。</p></blockquote><ul><li>测试 Docker</li></ul><p></p>
<pre data-index="8" class="new-version hljs set-code-show" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-cobol">sudo docker run hello-world</code></pre>
<blockquote><p>需先配置国内镜像源。现在可用的镜像源越来越少了,推荐一篇良心博文:https://zhuanlan.zhihu.com/p/24461370776。</p></blockquote><p>安装成功的验证结果信息如下:</p>
<pre data-index="9" class="new-version hljs set-code-height set-code-hide" name="code" style="white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important"><code class="hljs language-cobol">$ docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-worlde6590344b1a5: Pull complete Digest: sha256:dd01f97f252193ae3210da231b1dca0cffab4aadb3566692d6730bf93f123a48Status: Downloaded newer image for hello-world:latest Hello from Docker!This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.    (amd64) 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/</code></pre>
<p>Deepin 20.9 社区版安装 Docker 见文章:Deepin 20.9 社区版安装 Docker。</p><p>DockerHub 镜像源配置见文章:Linux 配置 DockerHub 镜像源配置。</p><p>Docker <span class="words-blog hl-git-1" data-report-view="{&quot;spm&quot;:&quot;1001.2101.3001.10283&quot;,&quot;extra&quot;:&quot;{\&quot;words\&quot;:\&quot;Compose\&quot;}&quot;}" data-tit="Compose" data-pretit="compose">Compose</span> 安装见文章:Linux 系统 Docker Compose 安装。</p></div><br><br>
来源:https://www.cnblogs.com/yjbjingcha/p/18985989
頁: [1]
查看完整版本: Deepin 23.10安装Docker - 指南