id: 6b6c0e50ac14410d8c6607f8de5bbb94
parent_id: 
item_type: 1
item_id: eae9f6fd07274a93bfca8bd262b79ecb
item_updated_time: 1764345631638
title_diff: "[{\"diffs\":[[1,\"告别繁琐！Docker 容器一键转 Compose 神器，让迁移像搭乐高一样简单\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":40}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>告别繁琐！Docker 容器一键转 Compose 神器，让迁移像搭乐高一样简单</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"content-class\\\" content=\\\"yinxiang.peso.superNote\\\"/>\\\r\\\n  <meta name=\\\"application-data:yinxiang.noteLayout\\\" content=\\\"{\\\"lineSpace\\\":\\\"recommend\\\",\\\"paragraphSpace\\\":\\\"recommend\\\"}\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"41933\\\"></a>\\\r\\\n<h1>告别繁琐！Docker 容器一键转 Compose 神器，让迁移像搭乐高一样简单</h1>\\\r\\\n\\\r\\\n<div><span style=\\\"margin:0px;\\\"><div style=\\\"padding:8px 0px;margin:8px auto;max-width:700px;\\\"> <div><span></span></div>\\\n<p></p>\\\n<div style=\\\"--en-blockquote:true;box-sizing: border-box; padding-left: 19px; padding-top: 6px; padding-bottom: 6px; border-left: 3px solid #b4c0cc; background-position: initial initial; background-repeat: initial initial; margin-top: 6px\\\"><div>原文链接: <a href=\\\"http://mp.weixin.qq.com/s?__biz=MzIxODI1MzYyNQ==&amp;mid=2247485607&amp;idx=1&amp;sn=db009b649aa0eb064f10beb779bad68f&amp;chksm=966f50857243e8009ae01229e8cfbf3ca47912e77add105836ae55633eeb921ecde9e2255642&amp;mpshare=1&amp;scene=1&amp;srcid=050741JnIpbaDGoZC53Ng30Q&amp;sharer_shareinfo=d967a4253c3348ba597ecae2052782b2&amp;sharer_shareinfo_first=d967a4253c3348ba597ecae2052782b2#rd\\\"><span>http://mp.weixin.qq.com/s?__biz=MzIxODI1MzYyNQ==&amp;mid=2247485...</span></a></div></div>\\\n<p></p>\\\n<div><span></span></div>\\\n<div style=\\\"\\\"><div><div><h1 style=\\\"margin:0\\\"> 告别繁琐！Docker 容器一键转 Compose 神器，让迁移像搭乐高一样简单 </h1><div><span style=\\\"position:relative\\\">原创</span><span><span style=\\\"position:relative\\\">小明同学的笔记</span></span><span><a style=\\\"position:relative\\\"> 小明同学的笔记 </a></span><span><em></em></span></div><div style=\\\";\\\"><div style=\\\"font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Helvetica, Arial, sans-serif;line-height: 1.75;font-size: 16px;\\\"><p style=\\\"margin:1em 0\\\"><span>还在为手动编写 Docker Compose 文件而头疼？这款神器能帮你一键搞定，将现有 Docker 容器信息转换为 </span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>docker-compose.yaml</span></code><span> 文件，轻松实现容器迁移和管理！</span></p><p style=\\\"margin:1em 0\\\"><span>项目直达：👉 coracoo/docker2compose</span><sup style=\\\"color: rgb(0, 105, 194);\\\"><span>[1]</span></sup><span><img src=\\\":/8e0e399f0f0648cd9c803459b69bc7cd\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;max-width: 100%;margin: 0px auto;display: block;height: auto !important;\\\"/></span></p><hr style=\\\"border-top: 1px solid rgb(221, 221, 221);border-right: none;border-bottom: none;border-left: none;border-image: initial;margin-top: 2em;margin-bottom: 2em;\\\"/><h2 style=\\\"margin:1em 0;text-align:center;font-size:1.2em;border-bottom:1px solid rgb(247,247,247);font-weight:bold\\\"><strong><span>🔥 核心功能，解决你的痛点：</span></strong></h2><p style=\\\"margin:1em 0\\\"><span>1️⃣ </span><strong><span>智能网络分组，告别手动配置</span></strong><span>： ▸ 自动分析容器间连接（兼容自定义网络/Links），无需手动梳理。 ▸ 将有关联的容器自动分组，生成独立的 </span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>docker-compose.yaml</span></code><span> 文件，结构清晰。</span></p><p style=\\\"margin:1em 0\\\"><span>2️⃣ </span><strong><span>全参数覆盖，保留你的配置</span></strong><span>： ▸ - 支持提取镜像、端口、卷、环境变量、设备挂载等 23+ 配置项，不遗漏任何细节。 ▸ - 保留特权模式、</span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>cap_add</span></code><span> 等高级参数，满足你的个性化需求。 ▸ - 智能过滤极空间 NAS 兼容性差的参数（如性能限制），避免潜在问题。</span></p><hr style=\\\"border-top: 1px solid rgb(221, 221, 221);border-right: none;border-bottom: none;border-left: none;border-image: initial;margin-top: 2em;margin-bottom: 2em;\\\"/><h2 style=\\\"margin:1em 0;text-align:center;font-size:1.2em;border-bottom:1px solid rgb(247,247,247);font-weight:bold\\\"><strong><span>🛠️ 使用姿势，简单易上手：</span></strong></h2><p style=\\\"margin:1em 0\\\"><span>启用前确保系统安装了docker和docker compose。</span></p><h4 style=\\\"margin:1em 0;font-size:1em;font-weight:bold\\\"><strong><span>方式一：Docker 部署</span></strong></h4><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker run -itd --name d2c \\\\</span><div><span>  -v /var/run/docker.sock:/var/run/docker.sock:ro \\\\</span></div><div><span>  -v /宿主机存储路径:/app/compose \\\\</span></div><div><span>  -e NAS=debian \\\\ <span># 可选，默认debian，详见下文说明</span></span></div><div><span>  -e CRON=<span>&quot;0 */12 * * *&quot;</span> \\\\ <span># 可选，默认每天0点起，每天12小时执行一次，详见下文说明</span></span></div><div><span>  -e NETWORK=<span>true</span> \\\\ <span># 可选，默认true，详见下文说明</span></span></div><div><span>  -e TZ=Asia/Shanghai \\\\ <span># 可选，默认Asia/Shanghai</span></span></div><div><span>  <span># 阿里云镜像源，国内选择</span></span></div><div><span>  crpi-xg6dfmt5h2etc7hg.cn-hangzhou.personal.cr.aliyuncs.com/cherry4nas/d2c:latest</span></div><div><span>  <span># github镜像源</span></span></div><div><span>  <span># ghcr.io/coracoo/d2c:latest</span></span></div></div></pre></div><h4 style=\\\"margin:1em 0;font-size:1em;font-weight:bold\\\"><strong><span><br/></span></strong></h4><p style=\\\"margin:1em 0\\\"><span>⚠️ </span><strong><span>重要提示：</span></strong><span> 请务必将 </span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>/宿主机存储路径</span></code><span> 替换为你实际的目录，例如 </span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>/opt/d2c-output</span></code><span>，用于存放生成的 Compose 文件。</span></p><h4 style=\\\"margin:1em 0;font-size:1em;font-weight:bold\\\"><strong><span>方式二：Docker Compose 部署（推荐✨）</span></strong></h4><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>services:</span><div><span>    d2c:</span></div><div><span>        <span># 阿里云镜像源，国内选择</span></span></div><div><span>        image: crpi-xg6dfmt5h2etc7hg.cn-hangzhou.personal.cr.aliyuncs.com/cherry4nas/d2c:latest</span></div><div><span>        <span># github镜像源</span></span></div><div><span>        <span># image: ghcr.io/coracoo/d2c:latest</span></span></div><div><span>        container_name: d2c</span></div><div><span>        volumes:</span></div><div><span>            - /var/run/docker.sock:/var/run/docker.sock:ro</span></div><div><span>            - /opt/d2c-output:/app/compose</span></div><div><span>        environment:</span></div><div><span>            - NAS=debian</span></div><div><span>            - CRON=<span>&quot;0 */12 * * *&quot;</span></span></div><div><span>            - NETWORK=<span>true</span></span></div><div><span>            - TZ=Asia/Shanghai</span></div></div></pre></div><h4 style=\\\"margin:1em 0;font-size:1em;font-weight:bold\\\"><strong><span><br/></span></strong></h4><p style=\\\"margin:1em 0\\\"><span>转换完成文件输出至</span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>/opt/d2c-output</span></code><span>目录</span></p><p style=\\\"margin:1em 0\\\"><span>⚠️ </span><strong><span>环境变量说明：</span></strong></p><ul style=\\\"margin:0;padding-left:1.2em\\\"><li style=\\\"margin-left: 1.2em;\\\"><code><span>NAS</span></code><div><span>: 指定NAS系统类型</span></div></li><ul style=\\\"margin:0;padding-left:1.2em\\\"><li style=\\\"margin-left: 1.2em;\\\"><code><span>debian</span></code><div><span>: 默认值，生成完整配置</span></div></li><li style=\\\"margin-left: 1.2em;\\\"><code><span>zos</span></code><div><span>: 极空间系统，不生成command和entrypoint配置</span></div></li></ul></ul><p style=\\\"margin:1em 0\\\"><span>其他变量请查看项目说明，这里就不详细说明了<img src=\\\":/e7ca18125b1c40f5b874e0784795f592\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;max-width: 100%;margin: 0px auto;display: block;height: auto !important;\\\"/></span></p><hr style=\\\"border-top: 1px solid rgb(221, 221, 221);border-right: none;border-bottom: none;border-left: none;border-image: initial;margin-top: 2em;margin-bottom: 2em;\\\"/><h2 style=\\\"margin:1em 0;text-align:center;font-size:1.2em;border-bottom:1px solid rgb(247,247,247);font-weight:bold\\\"><strong><span>📂 生成文件说明</span></strong></h2><table style=\\\"border-collapse: collapse;margin: 1.4em auto;max-width: 100%;table-layout: fixed;text-align: left;overflow: auto;display: table;overflow-wrap: break-word;word-break: break-all;\\\"><thead><tr><th style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;font-weight: bold;background-color: rgb(240, 240, 240);\\\"><div><span>文件类型</span></div></th><th style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;font-weight: bold;background-color: rgb(240, 240, 240);\\\"><div><span>命名规则</span></div></th></tr></thead><tbody><tr><td style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;\\\"><div><span>独立容器</span></div></td><td style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;\\\"><code><span>{容器名}.yaml</span></code></td></tr><tr style=\\\"background-color: rgb(248, 248, 248);\\\"><td style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;\\\"><div><span>容器组</span></div></td><td style=\\\"font-size: 0.75em;padding: 9px 12px;line-height: 22px;color: rgb(34, 34, 34);border: 1px solid rgb(216, 216, 216);vertical-align: top;\\\"><code><span>{首容器名}-group.yaml</span></code></td></tr></tbody></table><p style=\\\"margin:1em 0\\\"><span>所有文件保存在</span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>compose/</span></code><span>子目录 📁<img src=\\\":/a183112e3b2e4e98bbd90777e2cc7c5d\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;max-width: 100%;margin: 0px auto;display: block;height: auto !important;\\\"/></span></p><hr style=\\\"border-top: 1px solid rgb(221, 221, 221);border-right: none;border-bottom: none;border-left: none;border-image: initial;margin-top: 2em;margin-bottom: 2em;\\\"/><h2 style=\\\"margin:1em 0;text-align:center;font-size:1.2em;border-bottom:1px solid rgb(247,247,247);font-weight:bold\\\"><strong><span>⭐重新部署容器</span></strong></h2><p style=\\\"margin:1em 0\\\"><span>接下来，我们就要将容器以compose的方式重新部署一遍， </span><strong><span>在部署之前，我们需要确保所有的存量docker都是停止状态。为了确保原先容器的安全，强烈建议大家修改一下容器的名称 </span><code style=\\\"font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;color: rgb(255, 80, 44);padding: 4px 6px;font-size: 0.78em;\\\"><span>container_name</span></code><span> 这里，确保和原先的容器不冲突</span></strong><span>。</span></p><p style=\\\"margin:1em 0\\\"><span>选择刚才导出的yaml文件导入。测试一下容器有没有问题，没问题，那么就可以把原来单独部署的容器删掉，改用compose部署的容器了。<img src=\\\":/a78a2bd5891c48cf884c6f51e9c3ca05\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;max-width: 100%;margin: 0px auto;display: block;height: auto !important;\\\"/>如果要修改容器信息，也很简单。来到具体compose项目页面，修改代码、保存、重新构建一步到位。</span></p><h2 style=\\\"margin:1em 0;text-align:center;font-size:1.2em;border-bottom:1px solid rgb(247,247,247);font-weight:bold\\\"><strong><span>❗ 使用注意事项：</span></strong></h2><ol style=\\\"margin:0;padding-left:1.2em\\\"><li style=\\\"margin-left: 1.2em;\\\"><strong><span>Docker 命令行权限：</span></strong><div><span> 确保你拥有 Docker 命令行执行权限，以便工具能够访问 Docker 守护进程。</span></div></li><li style=\\\"margin-left: 1.2em;\\\"><strong><span>默认网络：</span></strong><div><span> 默认网络会被标记为 </span><code><span>external: true</span></code><span>，你需要手动预先创建这些网络。</span></div></li><li style=\\\"margin-left: 1.2em;\\\"><strong><span>人工校对：</span></strong><div><span> 在个别复杂场景下，建议人工校对生成的 YAML 文件，确保配置的准确性。</span></div></li></ol><hr style=\\\"border-top: 1px solid rgb(221, 221, 221);border-right: none;border-bottom: none;border-left: none;border-image: initial;margin-top: 2em;margin-bottom: 2em;\\\"/><p style=\\\"margin:1em 0\\\"><strong><span>还在等什么？立即体验这款神器，让容器迁移变得轻松愉快！🎉</span></strong></p><h3 style=\\\"margin:1em 0;font-size:1em;font-weight:bold\\\"><span>引用链接</span></h3><div><p style=\\\"margin:0;display:flex;font-size:0.9em\\\"><span style=\\\"display: inline;width: 10%;\\\"><span>[1]</span></span><span style=\\\"display: inline;width: 90%;overflow-wrap: break-word;word-break: break-all;\\\"><span>coracoo/docker2compose: </span><i><span>https://github.com/coracoo/docker2compose</span></i></span></p></div></div><div><span></span></div><div><span></span></div><div><span></span></div><div><span></span></div></div></div></div></div></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":14236}]"
metadata_diff: {"new":{"id":"eae9f6fd07274a93bfca8bd262b79ecb","parent_id":"f67288c3a0be4374b5d532b5dcc3aabc","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764348841032,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T21:04:11.391Z
created_time: 2025-11-28T21:04:11.391Z
type_: 13