id: 5200a7dbb85346c3a20d654ce44e6b94
parent_id: 
item_type: 1
item_id: 5a7213b692534abaa0057977457f2bbe
item_updated_time: 1764345507050
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=\\\"38677\\\"></a>\\\r\\\n<h1>docker 系列篇之七： dockerfile</h1>\\\r\\\n\\\r\\\n<div><span><p><br/></p><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=MzIyMjM0MTgxMw==&amp;mid=2247483926&amp;idx=1&amp;sn=1736413989b59013cc8ced0801424667&amp;chksm=e9d57825a56203fb9c320dfb50c210f31ceeb8d72a4aecdce81fdc7d188cdeb5693735ff46e6&amp;mpshare=1&amp;scene=1&amp;srcid=0321OTmP1sFfNUqjpZKnAimb&amp;sharer_shareinfo=f3847a8db514ce4d6ed6e73cd61dcdfd&amp;sharer_shareinfo_first=f3847a8db514ce4d6ed6e73cd61dcdfd#rd\\\" rev=\\\"en_rl_none\\\">http://mp.weixin.qq.com/s?__biz=MzIyMjM0MTgxMw==&amp;mid=2247483...</a></div></div><p><br/></p><div>原创 阿平Boy  架构师阿平 </div><div><span style=\\\"font-weight: bold;\\\">什么是Dockerfile：</span></div><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:0px;\\\" width=\\\"0px\\\"><colgroup></colgroup><tbody><tr></tr></tbody></table><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div>dockerfile 就是构建镜像的文件，通过定义脚本可以一层一层地生成镜像，每个命令都是一层。</div></td></tr></tbody></table><p> 创建一个dockerfile文件，名字可以随机，建议dockerfile</p><p># 文件中的内容：指令都是大写</p><p>FROM centos</p><p>VOLUME [&quot;volume01&quot;,&quot;volume02&quot;]</p><p>CMD echo &quot;-----end-----&quot;</p><p>CMD /bin/bash</p><p># 这里的每个命令，就是镜像的一层。</p><p>制作镜像：</p><img src=\\\":/4c6a2319cfe74fc7a9126fc9251ccf32\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\" width=\\\"auto\\\"/><p>启动容器：</p><div style=\\\"--en-codeblock:true;--en-blockId:MchWSqhK1UO;--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 style=\\\"color: rgb(51, 51, 51);\\\">docker run -it dfb3bdf775b3  /bin/bash\\\n</span></div><img src=\\\":/bc9382a36ff54e04845717e2c08b3414\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\" width=\\\"auto\\\"/><p><span style=\\\"font-weight: bold;\\\">多个容器同步数据</span></p><p>用上面的镜像脚本启动两个容器</p><img src=\\\":/058221d6e929401895455041e74379d7\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\" width=\\\"auto\\\"/><p>启动第一个容器 ，数据卷 v001  和 v002</p><img src=\\\":/78b80e15e240445e8ac345ebb34c00c2\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\" width=\\\"auto\\\"/><p>启动第二个容器，同步li01 的内容</p><img src=\\\":/627e31c00a4d490fab289483bb29f2b5\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\" width=\\\"auto\\\"/><p>反向从li02 容器 创建的文件 li01  容器同样可以看到。</p><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div><code style=\\\"-en-code: true\\\">   俩个容器的数据是 互相拷贝的  删除任意一个 其余的容器都可以看到那些数据  当然 所以的容器都删了  也就会删除了 除非做了持久化映射 </code></div></td></tr></tbody></table><p><span style=\\\"font-weight: bold;\\\">结论：</span></p><table style=\\\"--en-fitwindow:false;border-left:1px solid #d9d9d9;border-top:1px solid #d9d9d9;border-collapse:collapse;width:190px;\\\" width=\\\"190px\\\"><colgroup><col style=\\\"width: 190px;\\\"></col></colgroup><tbody><tr><td style=\\\"--en-typeInfo:{&quot;type&quot;:&quot;text&quot;,&quot;data&quot;:{}};border-right:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:10px;\\\"><div><span style=\\\"color: rgb(77, 77, 77);\\\"><b><span style=\\\"font-weight: 700;\\\">容器之间配置信息的传递，没有做持久化或者临时启动的数据卷容器的生命同期一直持续到没有容器使用为止。</span></b></span></div><div><span style=\\\"color: rgb(77, 77, 77);\\\"><b><span style=\\\"font-weight: 700;\\\">但是一旦你持久化到了本地或存储，这个时候，本地的数据是不会删除的！</span></b></span></div></td></tr></tbody></table><p><br/></p></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":5537}]"
metadata_diff: {"new":{"id":"5a7213b692534abaa0057977457f2bbe","parent_id":"061de1401cfc4cfaadf6e74e015970e9","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":1764345781399,"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-28T16:20:15.954Z
created_time: 2025-11-28T16:20:15.954Z
type_: 13