{"id":201543,"date":"2020-09-29T09:09:12","date_gmt":"2020-09-29T01:09:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=201543"},"modified":"2020-09-23T14:09:47","modified_gmt":"2020-09-23T06:09:47","slug":"docker-pros-cons","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-pros-cons.html","title":{"rendered":"Docker\u7684\u4f18\u7f3a\u70b9"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Docker \u4e3b\u8981\u89e3\u51b3\u73af\u5883\u914d\u7f6e\u95ee\u9898\uff0c\u5b83\u662f\u4e00\u79cd\u865a\u62df\u5316\u6280\u672f\uff0c\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u9694\u79bb\uff0c\u88ab\u9694\u79bb\u7684\u8fdb\u7a0b\u72ec\u7acb\u4e8e\u5bbf\u4e3b\u64cd\u4f5c\u7cfb\u7edf\u548c\u5176\u5b83\u9694\u79bb\u7684\u8fdb\u7a0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Docker\u89e3\u51b3\u7684\u95ee\u9898\uff1a<\/strong><\/div>\n \u7531\u4e8e\u4e0d\u540c\u7684\u673a\u5668\u6709\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u4ee5\u53ca\u4e0d\u540c\u7684\u5e93\u548c\u7ec4\u4ef6\uff0c\u5728\u5c06\u4e00\u4e2a\u5e94\u7528\u90e8\u7f72\u5230\u591a\u53f0\u673a\u5668\u4e0a\u9700\u8981\u8fdb\u884c\u5927\u91cf\u7684\u73af\u5883\u914d\u7f6e\u64cd\u4f5c\u3002<\/p>\n Docker \u4e3b\u8981\u89e3\u51b3\u73af\u5883\u914d\u7f6e\u95ee\u9898\uff0c\u5b83\u662f\u4e00\u79cd\u865a\u62df\u5316\u6280\u672f\uff0c\u5bf9\u8fdb\u7a0b\u8fdb\u884c\u9694\u79bb\uff0c\u88ab\u9694\u79bb\u7684\u8fdb\u7a0b\u72ec\u7acb\u4e8e\u5bbf\u4e3b\u64cd\u4f5c\u7cfb\u7edf\u548c\u5176\u5b83\u9694\u79bb\u7684\u8fdb\u7a0b\u3002\u4f7f\u7528 Docker \u53ef\u4ee5\u4e0d\u4fee\u6539\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\uff0c\u4e0d\u9700\u8981\u5f00\u53d1\u4eba\u5458\u5b66\u4e60\u7279\u5b9a\u73af\u5883\u4e0b\u7684\u6280\u672f\uff0c\u5c31\u80fd\u591f\u5c06\u73b0\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90e8\u7f72\u5728\u5176\u5b83\u673a\u5668\u4e0a\u3002<\/p>\n <\/p>\n \u4e0e\u865a\u62df\u673a\u7684\u6bd4\u8f83:<\/strong><\/div>\n \u865a\u62df\u673a\u4e5f\u662f\u4e00\u79cd\u865a\u62df\u5316\u6280\u672f\uff0c\u5b83\u4e0e Docker \u6700\u5927\u7684\u533a\u522b\u5728\u4e8e\u5b83\u662f\u901a\u8fc7\u6a21\u62df\u786c\u4ef6\uff0c\u5e76\u5728\u786c\u4ef6\u4e0a\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edf\u6765\u5b9e\u73b0\u3002<\/p>\n <\/p>\n \u542f\u52a8\u901f\u5ea6<\/strong><\/div>\n \u542f\u52a8\u865a\u62df\u673a\u9700\u8981\u5148\u542f\u52a8\u865a\u62df\u673a\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u518d\u542f\u52a8\u5e94\u7528\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u975e\u5e38\u6162\uff1b<\/p>\n \u800c\u542f\u52a8 Docker \u76f8\u5f53\u4e8e\u542f\u52a8\u5bbf\u4e3b\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684\u4e00\u4e2a\u8fdb\u7a0b\u3002<\/p>\n \u5360\u7528\u8d44\u6e90<\/strong><\/div>\n \u865a\u62df\u673a\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u9700\u8981\u5360\u7528\u5927\u91cf\u7684\u78c1\u76d8\u3001\u5185\u5b58\u548c CPU \u8d44\u6e90\uff0c\u4e00\u53f0\u673a\u5668\u53ea\u80fd\u5f00\u542f\u51e0\u5341\u4e2a\u7684\u865a\u62df\u673a\u3002<\/p>\n \u800c Docker \u53ea\u662f\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u53ea\u9700\u8981\u5c06\u5e94\u7528\u4ee5\u53ca\u76f8\u5173\u7684\u7ec4\u4ef6\u6253\u5305\uff0c\u5728\u8fd0\u884c\u65f6\u5360\u7528\u5f88\u5c11\u7684\u8d44\u6e90\uff0c\u4e00\u53f0\u673a\u5668\u53ef\u4ee5\u5f00\u542f\u6210\u5343\u4e0a\u4e07\u4e2a Docker\u3002<\/p>\n \u955c\u50cf\u4e0e\u5bb9\u5668:<\/strong><\/div>\n \u955c\u50cf\u662f\u4e00\u79cd\u9759\u6001\u7684\u7ed3\u6784\uff0c\u53ef\u4ee5\u770b\u6210\u9762\u5411\u5bf9\u8c61\u91cc\u9762\u7684\u7c7b\uff0c\u800c\u5bb9\u5668\u662f\u955c\u50cf\u7684\u4e00\u4e2a\u5b9e\u4f8b\u3002<\/p>\n \u955c\u50cf\u5305\u542b\u7740\u5bb9\u5668\u8fd0\u884c\u65f6\u6240\u9700\u8981\u7684\u4ee3\u7801\u4ee5\u53ca\u5176\u5b83\u7ec4\u4ef6\uff0c\u5b83\u662f\u4e00\u79cd\u5206\u5c42\u7ed3\u6784\uff0c\u6bcf\u4e00\u5c42\u90fd\u662f\u53ea\u8bfb\u7684\uff08read-only layers\uff09\u3002\u6784\u5efa\u955c\u50cf\u65f6\uff0c\u4f1a\u4e00\u5c42\u4e00\u5c42\u6784\u5efa\uff0c\u524d\u4e00\u5c42\u662f\u540e\u4e00\u5c42\u7684\u57fa\u7840\u3002\u955c\u50cf\u7684\u8fd9\u79cd\u5206\u5c42\u5b58\u50a8\u7ed3\u6784\u5f88\u9002\u5408\u955c\u50cf\u7684\u590d\u7528\u4ee5\u53ca\u5b9a\u5236\u3002<\/p>\n \u6784\u5efa\u5bb9\u5668\u65f6\uff0c\u901a\u8fc7\u5728\u955c\u50cf\u7684\u57fa\u7840\u4e0a\u6dfb\u52a0\u4e00\u4e2a\u53ef\u5199\u5c42\uff08writable layer\uff09\uff0c\u7528\u6765\u4fdd\u5b58\u7740\u5bb9\u5668\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u4fee\u6539\u3002<\/p>\n \u4f18\u7f3a\u70b9:<\/strong><\/div>\n 1. \u90e8\u7f72\u65b9\u4fbf<\/strong><\/span><\/div>\n \u4f60\u4e00\u5b9a\u8fd8\u6709\u5370\u8c61\uff0c\u5728\u6211\u4eec\u6700\u5f00\u59cb\u5b66\u4e60\u7f16\u7a0b\u7684\u65f6\u5019\uff0c\u642d\u5efa\u73af\u5883\u8fd9\u4e00\u6b65\u5f80\u5f80\u4f1a\u8017\u8d39\u6211\u4eec\u597d\u51e0\u4e2a\u5c0f\u65f6\u7684\u65f6\u95f4\uff0c\u800c\u4e14\u5176\u4e2d\u4e00\u4e2a\u5c0f\u95ee\u9898\u53ef\u80fd\u9700\u8981\u627e\u5f88\u4e45\u624d\u80fd\u591f\u89e3\u51b3\u3002\u4f60\u8fd8\u4f1a\u5f97\u5230\u5173\u4e8e\u73af\u5883\u642d\u5efa\u65b9\u9762\u7684\u56e2\u961f\u5176\u4ed6\u6210\u5458\u7684\u6c42\u52a9\u3002\u800c\u6709\u4e86\u5bb9\u5668\u4e4b\u540e\uff0c\u8fd9\u4e9b\u90fd\u53d8\u5f97\u975e\u5e38\u5bb9\u6613\uff0c\u4f60\u7684\u5f00\u53d1\u73af\u5883\u5c31\u53ea\u662f\u4e00\u4e2a\u6216\u8005\u51e0\u4e2a\u5bb9\u5668\u955c\u50cf\u7684\u5730\u5740\uff0c\u6700\u591a\u518d\u9700\u8981\u4e00\u4e2a\u63a7\u5236\u90e8\u7f72\u6d41\u7a0b\u7684\u6267\u884c\u811a\u672c\u3002\u6216\u8005\u8fdb\u4e00\u6b65\u5c06\u4f60\u7684\u73af\u5883\u955c\u50cf\u4ee5\u53ca\u955c\u50cf\u811a\u672c\u653e\u5165\u4e00\u4e2agit\u9879\u76ee\uff0c\u53d1\u5e03\u5230\u4e91\u7aef\uff0c\u9700\u8981\u7684\u65f6\u5019\u5c06\u5b83\u62c9\u5230\u672c\u5730\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n # git clone https:\/\/github.com\/my-project \r\n# sh .\/my-build-boot.sh \r\n<\/pre>\n |