id: 27f484c9af1a428aaf1c35b0dfe9b2b2
parent_id: 
item_type: 1
item_id: f9f52d4e0a6f4593a0a97c5ba22f9586
item_updated_time: 1764345622790
title_diff: "[{\"diffs\":[[1,\"docker 系列篇之七： dockerfile\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":24}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>docker 系列篇之七： dockerfile</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=\\\"38515\\\"></a>\\\r\\\n<h1>docker 系列篇之七： dockerfile</h1>\\\r\\\n\\\r\\\n<div><span style=\\\"\\\"><div style=\\\"max-width: 700px;\\\"><p></p><div style=\\\"--en-blockquote: true; box-sizing: border-box; border-left: 3px solid #b4c0cc; background-position: initial initial; background-repeat: initial initial;\\\"><div>原文链接: <a href=\\\"http://mp.weixin.qq.com/s?__biz=MzIyMjM0MTgxMw==&amp;mid=2247483926&amp;idx=1&amp;sn=1736413989b59013cc8ced0801424667&amp;chksm=e91ec3c7ebedec2733a18281157144aa6a358640bfdeb792c75299151dafb01dc561d3d0ad29&amp;mpshare=1&amp;scene=1&amp;srcid=0319sxAGkfuyouReXVKeYY1X&amp;sharer_shareinfo=7b24b8725554375d59298cc53294e8d2&amp;sharer_shareinfo_first=7b24b8725554375d59298cc53294e8d2#rd\\\"><span>http://mp.weixin.qq.com/s?__biz=MzIyMjM0MTgxMw==&amp;mid=2247483...</span></a></div></div><p></p><div style=\\\"\\\"><div><div><div><span style=\\\"\\\">原创</span><span> 阿平Boy </span><span><a style=\\\"\\\"> 架构师阿平 </a></span><span><em></em></span></div><div style=\\\"\\\"><div><span><span style=\\\"font-weight: bold;\\\">什么是Dockerfile：</span></span></div><table></table><table><tbody><tr><td width=\\\"576\\\"><div><span>dockerfile 就是构建镜像的文件，通过定义脚本可以一层一层地生成镜像，每个命令都是一层。</span></div></td></tr></tbody></table><p style=\\\"\\\"><span> 创建一个dockerfile文件，名字可以随机，建议dockerfile</span></p><p style=\\\"\\\"><span># 文件中的内容：指令都是大写</span></p><p style=\\\"\\\"><span>FROM centos</span></p><p style=\\\"\\\"><span>VOLUME [&quot;volume01&quot;,&quot;volume02&quot;]</span></p><p style=\\\"\\\"><span>CMD echo &quot;-----end-----&quot;</span></p><p style=\\\"\\\"><span>CMD /bin/bash</span></p><p style=\\\"\\\"><span># 这里的每个命令，就是镜像的一层。</span></p><p style=\\\"\\\"><span>制作镜像：</span></p><div style=\\\"text-align: center;\\\"><img src=\\\":/41af913a6e694de68dbe33e8f624e672\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks: %7B%22align%22%3A%22center%22%7D; width: auto;\\\" width=\\\"auto\\\"/></div><p style=\\\"\\\"><span>启动容器：</span></p><div><div><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; 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;\\\"><pre><span>docker run -it dfb3bdf775b3  /bin/bash</span><br/></pre></div></div></div><div style=\\\"text-align: center;\\\"><img src=\\\":/4d2865bd08c24097a1c559b8dad240ad\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks: %7B%22align%22%3A%22center%22%7D; width: auto;\\\" width=\\\"auto\\\"/></div><p style=\\\"\\\"><span><span style=\\\"font-weight: bold;\\\">多个容器同步数据</span></span></p><p style=\\\"\\\"><span><span style=\\\"font-weight: normal;\\\">用上面的镜像脚本启动两个容器</span></span></p><div style=\\\"text-align: center;\\\"><img src=\\\":/c0f7f16960d548c2a70393fed1e6e833\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks: %7B%22align%22%3A%22center%22%7D; width: auto;\\\" width=\\\"auto\\\"/></div><p style=\\\"\\\"><span><span style=\\\"font-weight: normal;\\\">启动第一个容器 ，数据卷 v001  和 v002</span></span></p><div style=\\\"text-align: center;\\\"><img src=\\\":/e083005f0fc04845bee922a01de02b25\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks: %7B%22align%22%3A%22center%22%7D; width: auto;\\\" width=\\\"auto\\\"/></div><p style=\\\"\\\"><span><span style=\\\"font-weight: normal;\\\">启动第二个容器，同步li01 的内容</span></span></p><div style=\\\"text-align: center;\\\"><img src=\\\":/1bb810bc5b0149cc9fc801a7814ffb7c\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks: %7B%22align%22%3A%22center%22%7D; width: auto;\\\" width=\\\"auto\\\"/></div><p style=\\\"\\\"><span><span style=\\\"font-weight: normal;\\\">反向从li02 容器 创建的文件 li01  容器同样可以看到。</span></span></p><table><tbody><tr><td width=\\\"576\\\"><code><span><span>   俩个容器的数据是 互相拷贝的  删除任意一个 其余的容器都可以看到那些数据  当然 所以的容器都删了  也就会删除了 除非做了持久化映射 </span></span></code><code><span><br/></span></code></td></tr></tbody></table><p style=\\\"\\\"><span><span style=\\\"font-weight: bold;\\\">结论：</span></span></p><table><tbody><tr><td width=\\\"576\\\"><div><strong style=\\\"box-sizing: border-box; outline: 0px; font-weight: 700; font-synthesis-style: auto; overflow-wrap: break-word; color: rgb(77, 77, 77); font-style: normal; font-variant-ligatures: no-common-ligatures; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;\\\"><span>容器之间配置信息的传递，没有做持久化或者临时启动的数据卷容器的生命同期一直持续到没有容器使用为止。</span></strong></div><div><strong style=\\\"box-sizing: border-box; outline: 0px; font-weight: 700; font-synthesis-style: auto; overflow-wrap: break-word; color: rgb(77, 77, 77); font-style: normal; font-variant-ligatures: no-common-ligatures; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;\\\"><span>但是一旦你持久化到了本地或存储，这个时候，本地的数据是不会删除的！</span></strong></div></td></tr></tbody></table><p style=\\\"\\\"><span><br/></span></p></div></div></div></div></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":5998}]"
metadata_diff: {"new":{"id":"f9f52d4e0a6f4593a0a97c5ba22f9586","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":1764348826607,"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:02.632Z
created_time: 2025-11-28T21:04:02.632Z
type_: 13