{"id":176,"date":"2024-12-09T21:24:46","date_gmt":"2024-12-09T13:24:46","guid":{"rendered":"https:\/\/codeloveme.com\/?p=176"},"modified":"2024-12-22T18:53:30","modified_gmt":"2024-12-22T10:53:30","slug":"docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/","title":{"rendered":"Docker \u5165\u95e8\u6307\u5357"},"content":{"rendered":"<h1>\u7b80\u4ecb<\/h1>\n<p>Docker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u5316\u5e73\u53f0\uff0c\u9769\u547d\u6027\u5730\u7b80\u5316\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u90e8\u7f72\u548c\u7ba1\u7406\u3002\u60f3\u8c61\u5b83\u5c31\u50cf\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\"\u642c\u5bb6\u4e13\u5bb6\"\uff0c\u80fd\u5c06\u5e94\u7528\u7a0b\u5e8f\u53ca\u5176\u6240\u6709\u4f9d\u8d56\u6253\u5305\u5230\u4e00\u4e2a\u6807\u51c6\u5316\u7684\u5bb9\u5668\u4e2d\uff0c\u786e\u4fdd\u65e0\u8bba\u5728\u54ea\u91cc\u8fd0\u884c\uff0c\u90fd\u80fd\u4fdd\u6301\u4e00\u81f4\u7684\u73af\u5883\u548c\u6027\u80fd\u3002<\/p>\n<h2>Docker vs \u865a\u62df\u673a\uff1a<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u7279\u6027<\/th>\n<th>Docker<\/th>\n<th>\u865a\u62df\u673a<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\u865a\u62df\u5316\u65b9\u5f0f<\/strong><\/td>\n<td>\u64cd\u4f5c\u7cfb\u7edf\u7ea7\u522b\u865a\u62df\u5316\uff08\u5bb9\u5668\uff09<\/td>\n<td>\u786c\u4ef6\u7ea7\u522b\u865a\u62df\u5316\uff08\u5b8c\u6574\u7684\u64cd\u4f5c\u7cfb\u7edf\uff09<\/td>\n<\/tr>\n<tr>\n<td><strong>\u8d44\u6e90\u5229\u7528<\/strong><\/td>\n<td>\u66f4\u52a0\u9ad8\u6548\uff0c\u5bb9\u5668\u5171\u4eab\u5bbf\u4e3b\u673a\u5185\u6838<\/td>\n<td>\u8d44\u6e90\u5f00\u9500\u5927\uff0c\u6bcf\u4e2a\u865a\u62df\u673a\u90fd\u9700\u8981\u5b8c\u6574\u7684\u64cd\u4f5c\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td><strong>\u542f\u52a8\u65f6\u95f4<\/strong><\/td>\n<td>\u542f\u52a8\u901f\u5ea6\u5feb\uff08\u51e0\u79d2\u949f\uff09<\/td>\n<td>\u542f\u52a8\u901f\u5ea6\u6162\uff08\u53ef\u80fd\u9700\u8981\u51e0\u5206\u949f\uff09<\/td>\n<\/tr>\n<tr>\n<td><strong>\u8d44\u6e90\u9694\u79bb<\/strong><\/td>\n<td>\u5171\u4eab\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\uff0c\u9694\u79bb\u6027\u8f83\u5f31<\/td>\n<td>\u5b8c\u5168\u9694\u79bb\uff0c\u865a\u62df\u673a\u62e5\u6709\u72ec\u7acb\u7684\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838<\/td>\n<\/tr>\n<tr>\n<td><strong>\u6027\u80fd<\/strong><\/td>\n<td>\u9ad8\u6027\u80fd\uff0c\u8f83\u5c11\u7684\u8d44\u6e90\u6d6a\u8d39<\/td>\n<td>\u8f83\u9ad8\u7684\u6027\u80fd\u635f\u5931\uff0c\u7531\u4e8e\u865a\u62df\u5316\u7684\u5f00\u9500<\/td>\n<\/tr>\n<tr>\n<td><strong>\u4f7f\u7528\u573a\u666f<\/strong><\/td>\n<td>\u9002\u5408\u5fae\u670d\u52a1\u3001CI\/CD\u6d41\u6c34\u7ebf\u3001\u5f00\u53d1\u73af\u5883<\/td>\n<td>\u9002\u5408\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u8fd0\u884c\u3001\u72ec\u7acb\u5e94\u7528\u8fd0\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5b89\u88c5<\/h2>\n<h3>\u5b89\u88c5\u524d\u63d0<\/h3>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff1aWindows\u3001macOS \u6216 Linux<\/li>\n<li>\u7cfb\u7edf\u914d\u7f6e\uff1a\u63a8\u8350 64 \u4f4d\u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>\u786c\u4ef6\u8981\u6c42\uff1a\u81f3\u5c11 4GB \u5185\u5b58<\/li>\n<\/ul>\n<h3>\u5b89\u88c5\u6b65\u9aa4<\/h3>\n<ol>\n<li>\u8bbf\u95ee\u5b98\u65b9\u7f51\u7ad9 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.docker.com\/get-started\" target=\"_blank\"  rel=\"nofollow\" >Docker\u5b98\u7f51<\/a><\/li>\n<li>\u9009\u62e9\u9002\u5408\u5f53\u671f\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u5e94\u7248\u672c<\/li>\n<li>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u7a0b\u5e8f<\/li>\n<li>\u9a8c\u8bc1\u5b89\u88c5\uff1a\u5728\u7ec8\u7aef\/\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c <code>docker --version<\/code><\/li>\n<\/ol>\n<h1>\u5165\u95e8\u7bc7<\/h1>\n<h2>\u955c\u50cf\u7ba1\u7406<\/h2>\n<p>Docker \u955c\u50cf\u662f\u5bb9\u5668\u7684\u84dd\u56fe\uff0c\u5305\u542b\u5e94\u7528\u7684\u6240\u6709\u4ee3\u7801\u3001\u5e93\u3001\u4f9d\u8d56\u9879\u3001\u8bbe\u7f6e\u7b49\u3002\u901a\u8fc7 Docker \u955c\u50cf\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u5feb\u901f\u542f\u52a8\u5bb9\u5668\u3002<\/p>\n<h3>\u6982\u5ff5\u7406\u89e3<\/h3>\n<p>\u955c\u50cf\u662f\u5bb9\u5668\u7684\"\u6a21\u677f\"\uff0c\u7c7b\u4f3c\u4e8e\u8f6f\u4ef6\u5b89\u88c5\u5305\uff1a<\/p>\n<ul>\n<li>\u5305\u542b\u8fd0\u884c\u73af\u5883\u548c\u5e94\u7528\u4ee3\u7801<\/li>\n<li>\u53ea\u8bfb\u6a21\u677f\uff0c\u53ef\u6279\u91cf\u521b\u5efa\u5bb9\u5668<\/li>\n<li>\u53ef\u4ee5\u5c42\u5c42\u6784\u5efa\u548c\u7ee7\u627f<\/li>\n<li>\u53ef\u5728DockerHub\u5171\u4eab<\/li>\n<\/ul>\n<h3>\u5173\u952e\u7279\u70b9<\/h3>\n<ul>\n<li>\u57fa\u7840\u955c\u50cf\uff08\u5982Ubuntu\uff09<\/li>\n<li>\u5e94\u7528\u955c\u50cf\uff08\u5982Nginx\uff09<\/li>\n<li>\u7528\u4e8e\u5feb\u901f\u90e8\u7f72\u548c\u590d\u5236\u73af\u5883<\/li>\n<li>\u7248\u672c\u7ba1\u7406\u548c\u8ffd\u6eaf<\/li>\n<li>\u8f7b\u91cf\u7ea7\u3001\u53ef\u5feb\u901f\u4e0b\u8f7d\u548c\u4f20\u8f93<\/li>\n<\/ul>\n<h3>\u57fa\u672c\u955c\u50cf\u64cd\u4f5c<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>docker images<\/code><\/td>\n<td>\u5217\u51fa\u672c\u5730\u6240\u6709\u955c\u50cf<\/td>\n<td>-<\/td>\n<\/tr>\n<tr>\n<td><code>docker pull [\u955c\u50cf\u540d]<\/code><\/td>\n<td>\u4ece\u4ed3\u5e93\u62c9\u53d6\u955c\u50cf<\/td>\n<td><code>docker pull nginx<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>docker push [\u955c\u50cf\u540d]<\/code><\/td>\n<td>\u63a8\u9001\u955c\u50cf\u5230\u4ed3\u5e93<\/td>\n<td><code>docker push myuser\/myimage<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>docker rmi [\u955c\u50cfID]<\/code><\/td>\n<td>\u5220\u9664\u672c\u5730\u955c\u50cf<\/td>\n<td><code>docker rmi abc123<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>docker build<\/code><\/td>\n<td>\u6839\u636e Dockerfile \u6784\u5efa\u955c\u50cf<\/td>\n<td><code>docker build -t myapp .<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>docker save<\/code><\/td>\n<td>\u5bfc\u51fa\u955c\u50cf\u4e3a tar \u6587\u4ef6<\/td>\n<td><code>docker save -o myimage.tar nginx<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>docker load<\/code><\/td>\n<td>\u4ece tar \u6587\u4ef6\u52a0\u8f7d\u955c\u50cf<\/td>\n<td><code>docker load -i myimage.tar<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u521b\u5efa\u5e76\u8fd0\u884c\u5bb9\u5668<\/h3>\n<pre><code class=\"language-bash line-numbers\">docker run -d              # \u540e\u53f0\u8fd0\u884c\n--name nginx-container     # \u4e3a\u5bb9\u5668\u6307\u5b9a\u4e00\u4e2a\u540d\u79f0\n-p 80:80                   # \u7aef\u53e3\u6620\u5c04\uff1a\u4e3b\u673a80\u6620\u5c04\u5230\u5bb9\u566880\n-e ENV_VAR=value           # \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\nnginx                      # \u6307\u5b9a\u8fd0\u884c\u7684\u955c\u50cf\u540d\u79f0\uff08\u8fd9\u91cc\u662f nginx\uff0c\u53ef\u4ee5\u6362\u6210\u81ea\u5df1\u7684\u955c\u50cf\u540d\uff09\n<\/code><\/pre>\n<h2>\u5bb9\u5668\u7ba1\u7406<\/h2>\n<p>Docker \u5bb9\u5668\u662f\u8fd0\u884c\u4e2d\u7684\u5b9e\u4f8b\uff0c\u662f\u5728\u955c\u50cf\u7684\u57fa\u7840\u4e0a\u542f\u52a8\u7684\u3002\u5bb9\u5668\u63d0\u4f9b\u4e86\u9694\u79bb\u7684\u73af\u5883\uff0c\u5305\u62ec\u72ec\u7acb\u7684\u7f51\u7edc\u3001\u6587\u4ef6\u7cfb\u7edf\u548c\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n<h3>\u6982\u5ff5\u7406\u89e3<\/h3>\n<p>\u5bb9\u5668\u662f Docker \u7684\u6838\u5fc3\u6982\u5ff5\uff0c\u53ef\u4ee5\u7c7b\u6bd4\u4e3a\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\"\u865a\u62df\u673a\"\uff1a<\/p>\n<ul>\n<li>\u6253\u5305\u5e94\u7528\u53ca\u5176\u6240\u6709\u4f9d\u8d56<\/li>\n<li>\u63d0\u4f9b\u72ec\u7acb\u8fd0\u884c\u73af\u5883<\/li>\n<li>\u79d2\u7ea7\u542f\u52a8\u548c\u90e8\u7f72<\/li>\n<li>\u8d44\u6e90\u5360\u7528\u6781\u5c11<\/li>\n<li>\u53ef\u968f\u65f6\u521b\u5efa\u3001\u542f\u52a8\u3001\u505c\u6b62\u3001\u5220\u9664<\/li>\n<\/ul>\n<h3>\u5bb9\u5668\u7279\u70b9<\/h3>\n<p>\u5bb9\u5668\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u8fd0\u884c\u73af\u5883\uff0c\u5177\u6709\uff1a<\/p>\n<ul>\n<li>\u72ec\u7acb\u7f51\u7edc\u7a7a\u95f4<\/li>\n<li>\u72ec\u7acb\u6587\u4ef6\u7cfb\u7edf<\/li>\n<li>\u72ec\u7acb\u5185\u5b58\u8d44\u6e90<\/li>\n<li>\u9ad8\u5ea6\u9694\u79bb\uff0c\u4e92\u4e0d\u5f71\u54cd<\/li>\n<li>\u8f7b\u91cf\u7ea7\u3001\u53ef\u79fb\u690d<\/li>\n<\/ul>\n<h3>\u5bb9\u5668\u64cd\u4f5c<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>docker ps<\/code><\/td>\n<td>\u67e5\u770b\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668<\/td>\n<td>\u9ed8\u8ba4\u53ea\u663e\u793a\u6d3b\u8dc3\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker ps -a<\/code><\/td>\n<td>\u67e5\u770b\u6240\u6709\u5bb9\u5668<\/td>\n<td>\u5305\u62ec\u5df2\u505c\u6b62\u7684\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker stop [\u5bb9\u5668ID]<\/code><\/td>\n<td>\u505c\u6b62\u5bb9\u5668<\/td>\n<td>\u4ec5\u505c\u6b62\u8fdb\u7a0b\uff0c\u4e0d\u5220\u9664<\/td>\n<\/tr>\n<tr>\n<td><code>docker rm [\u5bb9\u5668ID]<\/code><\/td>\n<td>\u5220\u9664\u5df2\u505c\u6b62\u5bb9\u5668<\/td>\n<td>\u4e0d\u80fd\u5220\u9664\u8fd0\u884c\u4e2d\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker rm -f [\u5bb9\u5668ID]<\/code><\/td>\n<td>\u5f3a\u5236\u5220\u9664\u5bb9\u5668<\/td>\n<td>\u53ef\u5220\u9664\u8fd0\u884c\u4e2d\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker start [\u5bb9\u5668ID]<\/code><\/td>\n<td>\u542f\u52a8\u5df2\u505c\u6b62\u5bb9\u5668<\/td>\n<td>-<\/td>\n<\/tr>\n<tr>\n<td><code>docker logs [\u5bb9\u5668ID]<\/code><\/td>\n<td>\u67e5\u770b\u5bb9\u5668\u65e5\u5fd7<\/td>\n<td>\u8c03\u8bd5\u5e38\u7528<\/td>\n<\/tr>\n<tr>\n<td><code>docker exec -it [\u5bb9\u5668ID] bash<\/code><\/td>\n<td>\u8fdb\u5165\u5bb9\u5668\u5185\u90e8<\/td>\n<td>\u4ea4\u4e92\u5f0f\u7ec8\u7aef<\/td>\n<\/tr>\n<tr>\n<td><code>docker commit [\u5bb9\u5668ID] [\u955c\u50cf\u540d\u79f0]<\/code><\/td>\n<td>\u63d0\u4ea4\u5bb9\u5668\u4e3a\u955c\u50cf<\/td>\n<td>\u5c06\u5bb9\u5668\u7684\u5f53\u524d\u72b6\u6001\u4fdd\u5b58\u4e3a\u65b0\u955c\u50cf<\/td>\n<\/tr>\n<tr>\n<td><code>docker tag [\u955c\u50cfID] [\u65b0\u955c\u50cf\u540d\u79f0:\u6807\u7b7e]<\/code><\/td>\n<td>\u7ed9\u955c\u50cf\u6253\u6807\u7b7e<\/td>\n<td>\u4e3a\u955c\u50cf\u6dfb\u52a0\u6807\u7b7e\uff0c\u4fbf\u4e8e\u6807\u8bc6\u548c\u7ba1\u7406<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>\u8fdb\u9636\u7bc7<\/h1>\n<h2>Docker \u6570\u636e\u5377<\/h2>\n<p>\u6570\u636e\u5377\u662f Docker \u5bb9\u5668\u5b58\u50a8\u6570\u636e\u7684\u91cd\u8981\u673a\u5236\uff0c\u7528\u4e8e\u6301\u4e45\u5316\u548c\u5171\u4eab\u6570\u636e\uff0c\u89e3\u51b3\u5bb9\u5668\u6570\u636e\u5b58\u50a8\u7684\u5173\u952e\u95ee\u9898\u3002<\/p>\n<h3>\u6982\u5ff5\u7406\u89e3<\/h3>\n<p>\u6570\u636e\u5377\u662f\u72ec\u7acb\u4e8e\u5bb9\u5668\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c\u5177\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u53ef\u6301\u4e45\u5316\u5b58\u50a8\u5bb9\u5668\u6570\u636e<\/li>\n<li>\u652f\u6301\u5728\u591a\u4e2a\u5bb9\u5668\u95f4\u5171\u4eab\u6570\u636e<\/li>\n<li>\u72ec\u7acb\u4e8e\u5bb9\u5668\u751f\u547d\u5468\u671f<\/li>\n<li>\u6570\u636e\u53ef\u76f4\u63a5\u4fee\u6539\uff0c\u65e0\u9700\u901a\u8fc7\u5bb9\u5668<\/li>\n<li>\u63d0\u9ad8\u6570\u636e\u5b89\u5168\u6027\u548c\u7075\u6d3b\u6027<\/li>\n<\/ul>\n<h3>\u6570\u636e\u5377\u7279\u70b9<\/h3>\n<p>\u6570\u636e\u5377\u63d0\u4f9b\u4e86\u6bd4\u76f4\u63a5\u5728\u5bb9\u5668\u4e2d\u5b58\u50a8\u66f4\u52a0\u7075\u6d3b\u7684\u6570\u636e\u7ba1\u7406\u65b9\u5f0f\uff1a<\/p>\n<ul>\n<li>\u6570\u636e\u72ec\u7acb\u4e8e\u5bb9\u5668<\/li>\n<li>\u53ef\u4ee5\u5728\u591a\u4e2a\u5bb9\u5668\u95f4\u5171\u4eab<\/li>\n<li>\u652f\u6301\u591a\u79cd\u5b58\u50a8\u7c7b\u578b\uff08\u672c\u5730\u3001\u7f51\u7edc\u5b58\u50a8\uff09<\/li>\n<li>\u65b9\u4fbf\u6570\u636e\u5907\u4efd\u548c\u8fc1\u79fb<\/li>\n<li>\u6027\u80fd\u5f00\u9500\u4f4e<\/li>\n<\/ul>\n<h3>\u6570\u636e\u5377\u64cd\u4f5c<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>docker volume create [\u5377\u540d]<\/code><\/td>\n<td>\u521b\u5efa\u6570\u636e\u5377<\/td>\n<td>\u521b\u5efa\u4e00\u4e2a\u547d\u540d\u5377<\/td>\n<\/tr>\n<tr>\n<td><code>docker volume ls<\/code><\/td>\n<td>\u5217\u51fa\u6240\u6709\u6570\u636e\u5377<\/td>\n<td>\u663e\u793a\u5df2\u521b\u5efa\u7684\u6570\u636e\u5377<\/td>\n<\/tr>\n<tr>\n<td><code>docker volume inspect [\u5377\u540d]<\/code><\/td>\n<td>\u67e5\u770b\u6570\u636e\u5377\u8be6\u60c5<\/td>\n<td>\u663e\u793a\u5377\u7684\u5177\u4f53\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td><code>docker volume rm [\u5377\u540d]<\/code><\/td>\n<td>\u5220\u9664\u6570\u636e\u5377<\/td>\n<td>\u5220\u9664\u6307\u5b9a\u6570\u636e\u5377<\/td>\n<\/tr>\n<tr>\n<td><code>docker run -v [\u5377\u540d]:[\u5bb9\u5668\u8def\u5f84]<\/code><\/td>\n<td>\u6302\u8f7d\u6570\u636e\u5377<\/td>\n<td>\u5c06\u6570\u636e\u5377\u6302\u8f7d\u5230\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker run -v [\u672c\u5730\u8def\u5f84]:[\u5bb9\u5668\u8def\u5f84]<\/code><\/td>\n<td>\u7ed1\u5b9a\u6302\u8f7d<\/td>\n<td>\u5c06\u672c\u5730\u76ee\u5f55\u6620\u5c04\u5230\u5bb9\u5668<\/td>\n<\/tr>\n<tr>\n<td><code>docker volume prune<\/code><\/td>\n<td>\u6e05\u7406\u65e0\u7528\u6570\u636e\u5377<\/td>\n<td>\u5220\u9664\u672a\u88ab\u5bb9\u5668\u4f7f\u7528\u7684\u5377<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u6570\u636e\u5377\u4f7f\u7528\u793a\u4f8b<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u521b\u5efa\u6570\u636e\u5377\ndocker volume create mydata\n\n# \u5728 MySQL \u5bb9\u5668\u4e2d\u4f7f\u7528\u6570\u636e\u5377\ndocker run -d --name mysql-container \\\n    -v mydata:\/var\/lib\/mysql \\\n    -e MYSQL_ROOT_PASSWORD=mypassword \\\n    mysql:latest\n\n# \u672c\u5730\u76ee\u5f55\u6302\u8f7d\ndocker run -v \/host\/path:\/container\/path nginx:latest\n<\/code><\/pre>\n<h3>\u6570\u636e\u5377\u7c7b\u578b<\/h3>\n<ol>\n<li>\u533f\u540d\u5377\n<ul>\n<li>\u7cfb\u7edf\u81ea\u52a8\u751f\u6210\u540d\u79f0<\/li>\n<li>\u968f\u5bb9\u5668\u81ea\u52a8\u521b\u5efa\u548c\u5220\u9664<\/li>\n<\/ul>\n<\/li>\n<li>\u547d\u540d\u5377\n<ul>\n<li>\u624b\u52a8\u521b\u5efa\u5e76\u547d\u540d<\/li>\n<li>\u4fbf\u4e8e\u7ba1\u7406\u548c\u590d\u7528<\/li>\n<\/ul>\n<\/li>\n<li>\u7ed1\u5b9a\u6302\u8f7d\n<ul>\n<li>\u5c06\u672c\u5730\u4e3b\u673a\u76ee\u5f55\u76f4\u63a5\u6302\u8f7d\u5230\u5bb9\u5668<\/li>\n<li>\u5f00\u53d1\u548c\u6d4b\u8bd5\u5e38\u7528\u65b9\u5f0f<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>\u6700\u4f73\u5b9e\u8df5<\/h3>\n<ul>\n<li>\u4f7f\u7528\u547d\u540d\u5377\u7ba1\u7406\u6301\u4e45\u5316\u6570\u636e<\/li>\n<li>\u907f\u514d\u5728\u5bb9\u5668\u5185\u76f4\u63a5\u5b58\u50a8\u91cd\u8981\u6570\u636e<\/li>\n<li>\u5b9a\u671f\u5907\u4efd\u6570\u636e\u5377<\/li>\n<li>\u5408\u7406\u89c4\u5212\u5b58\u50a8\u7a7a\u95f4<\/li>\n<li>\u4f7f\u7528\u53ea\u8bfb\u5377\u63d0\u9ad8\u5b89\u5168\u6027<\/li>\n<\/ul>\n<h2>Docker \u7f51\u7edc<\/h2>\n<p>Docker \u7f51\u7edc\u662f\u5bb9\u5668\u95f4\u901a\u4fe1\u548c\u4e0e\u5916\u90e8\u7f51\u7edc\u4ea4\u4e92\u7684\u5173\u952e\u673a\u5236\uff0c\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u7f51\u7edc\u914d\u7f6e\u548c\u9694\u79bb\u65b9\u6848\u3002<\/p>\n<h3>\u6982\u5ff5\u7406\u89e3<\/h3>\n<p>Docker \u7f51\u7edc\u662f\u5bb9\u5668\u901a\u4fe1\u7684\u57fa\u7840\u8bbe\u65bd\uff0c\u5177\u6709\u4ee5\u4e0b\u6838\u5fc3\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b\u5bb9\u5668\u95f4\u7f51\u7edc\u9694\u79bb<\/li>\n<li>\u652f\u6301\u591a\u79cd\u7f51\u7edc\u6a21\u5f0f<\/li>\n<li>\u5b9e\u73b0\u5bb9\u5668\u4e0e\u5bbf\u4e3b\u673a\u7684\u7f51\u7edc\u4e92\u901a<\/li>\n<li>\u7b80\u5316\u590d\u6742\u7684\u7f51\u7edc\u914d\u7f6e<\/li>\n<li>\u652f\u6301\u8de8\u4e3b\u673a\u7f51\u7edc\u901a\u4fe1<\/li>\n<\/ul>\n<h3>\u7f51\u7edc\u7c7b\u578b<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u7f51\u7edc\u6a21\u5f0f<\/th>\n<th>\u7279\u70b9<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>bridge<\/td>\n<td>\u9ed8\u8ba4\u7f51\u7edc\u6a21\u5f0f<\/td>\n<td>\u5355\u673a\u5bb9\u5668\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td>host<\/td>\n<td>\u76f4\u63a5\u4f7f\u7528\u5bbf\u4e3b\u673a\u7f51\u7edc<\/td>\n<td>\u6027\u80fd\u654f\u611f\u5e94\u7528<\/td>\n<\/tr>\n<tr>\n<td>none<\/td>\n<td>\u7981\u7528\u7f51\u7edc<\/td>\n<td>\u5b8c\u5168\u9694\u79bb\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>overlay<\/td>\n<td>\u591a\u4e3b\u673a\u901a\u4fe1<\/td>\n<td>\u5206\u5e03\u5f0f\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td>macvlan<\/td>\n<td>\u76f4\u63a5\u8fde\u63a5\u7269\u7406\u7f51\u7edc<\/td>\n<td>\u9700\u8981\u72ec\u7acb MAC \u5730\u5740<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u7f51\u7edc\u64cd\u4f5c\u547d\u4ee4<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>docker network ls<\/code><\/td>\n<td>\u5217\u51fa\u6240\u6709\u7f51\u7edc<\/td>\n<td>\u67e5\u770b\u5f53\u524d\u7f51\u7edc\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td><code>docker network create<\/code><\/td>\n<td>\u521b\u5efa\u81ea\u5b9a\u4e49\u7f51\u7edc<\/td>\n<td>\u652f\u6301\u591a\u79cd\u7f51\u7edc\u9a71\u52a8<\/td>\n<\/tr>\n<tr>\n<td><code>docker network inspect<\/code><\/td>\n<td>\u67e5\u770b\u7f51\u7edc\u8be6\u7ec6\u4fe1\u606f<\/td>\n<td>\u83b7\u53d6\u7f51\u7edc\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td><code>docker network rm<\/code><\/td>\n<td>\u5220\u9664\u81ea\u5b9a\u4e49\u7f51\u7edc<\/td>\n<td>\u6e05\u7406\u4e0d\u9700\u8981\u7684\u7f51\u7edc<\/td>\n<\/tr>\n<tr>\n<td><code>docker run --network<\/code><\/td>\n<td>\u6307\u5b9a\u5bb9\u5668\u7f51\u7edc<\/td>\n<td>\u7cbe\u786e\u63a7\u5236\u7f51\u7edc\u8fde\u63a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u9ed8\u8ba4\u7f51\u7edc vs \u81ea\u5b9a\u4e49\u7f51\u7edc<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u7279\u6027<\/th>\n<th>\u9ed8\u8ba4\u7f51\u7edc (bridge)<\/th>\n<th>\u81ea\u5b9a\u4e49\u7f51\u7edc<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\u901a\u4fe1\u65b9\u5f0f<\/strong><\/td>\n<td>\u901a\u8fc7\u5bb9\u5668\u7684 IP \u5730\u5740\u901a\u4fe1\uff0c\u5bb9\u5668\u91cd\u542f\u540e IP \u53ef\u80fd\u53d8\u5316<\/td>\n<td>\u901a\u8fc7\u5bb9\u5668\u540d\u76f4\u63a5\u901a\u4fe1\uff0c\u5bb9\u5668\u540d\u89e3\u6790\u7a33\u5b9a<\/td>\n<\/tr>\n<tr>\n<td><strong>\u7f51\u7edc\u9694\u79bb<\/strong><\/td>\n<td>\u6240\u6709\u5bb9\u5668\u5171\u4eab\u540c\u4e00\u7f51\u7edc\uff0c\u9694\u79bb\u6027\u8f83\u5dee<\/td>\n<td>\u652f\u6301\u7cbe\u7ec6\u5316\u7f51\u7edc\u9694\u79bb\uff0c\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a\u7f51\u7edc<\/td>\n<\/tr>\n<tr>\n<td><strong>\u914d\u7f6e\u7075\u6d3b\u6027<\/strong><\/td>\n<td>\u914d\u7f6e\u7b80\u5355\uff0c\u65e0\u6cd5\u8fdb\u884c\u9ad8\u7ea7\u5b9a\u5236<\/td>\n<td>\u652f\u6301\u81ea\u5b9a\u4e49\u5b50\u7f51\u3001\u7f51\u5173\u7b49\u9ad8\u7ea7\u914d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td><strong>\u9002\u7528\u573a\u666f<\/strong><\/td>\n<td>\u7b80\u5355\u7684\u5355\u673a\u5e94\u7528\uff0c\u9002\u5408\u57fa\u7840\u7684\u5bb9\u5668\u901a\u4fe1<\/td>\n<td>\u9700\u8981\u9ad8\u9694\u79bb\u3001\u7a33\u5b9a\u901a\u4fe1\u6216\u5fae\u670d\u52a1\u67b6\u6784\u7684\u573a\u666f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u9ed8\u8ba4\u7f51\u7edc (bridge)<\/h4>\n<ol>\n<li><strong>docker0\u865a\u62df\u7f51\u6865<\/strong>\uff1a<br \/>\n\u5b89\u88c5 Docker \u65f6\uff0cDocker \u4f1a\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u7f51\u6865\uff08<code>docker0<\/code>\uff09\uff0c\u5e76\u4e3a\u5176\u914d\u7f6e\u4e00\u4e2a IP \u5730\u5740\u8303\u56f4\uff08\u4f8b\u5982\uff1a<code>172.17.0.1\/16<\/code>\uff09\u3002\u6240\u6709\u5bb9\u5668\u9ed8\u8ba4\u901a\u8fc7\u8be5\u865a\u62df\u7f51\u6865\u8fdb\u884c\u901a\u4fe1\u3002<\/p>\n<\/li>\n<li>\n<p><strong>IP \u5730\u5740\u5206\u914d<\/strong>\uff1a<br \/>\n\u6bcf\u4e2a\u5bb9\u5668\u542f\u52a8\u65f6\u90fd\u4f1a\u5206\u914d\u4e00\u4e2a IP \u5730\u5740\uff0c\u4f46<strong>\u5bb9\u5668\u91cd\u542f\u540e IP \u5730\u5740\u53ef\u80fd\u4f1a\u53d1\u751f\u53d8\u5316<\/strong>\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4e00\u4e2a\u5bb9\u5668\uff08\u5982 MySQL\uff09\u5728\u7cfb\u7edf\u91cd\u542f\u540e\u542f\u52a8\u987a\u5e8f\u4e0d\u540c\uff0c\u53e6\u4e00\u4e2a\u5bb9\u5668\u53ef\u80fd\u4f1a\u5360\u7528\u8be5 IP \u5730\u5740\uff0c\u5bfc\u81f4 MySQL \u5bb9\u5668\u83b7\u5f97\u65b0\u7684 IP\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5bb9\u5668\u95f4\u901a\u4fe1<\/strong>\uff1a<br \/>\n\u5728\u9ed8\u8ba4\u7684 <code>docker0<\/code> \u7f51\u7edc\u4e2d\uff0c\u5bb9\u5668\u4e4b\u95f4\u53ef\u4ee5\u901a\u8fc7\u5bb9\u5668\u7684 IP \u5730\u5740\u8fdb\u884c\u901a\u4fe1\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u5bb9\u5668\u540d\u76f4\u63a5\u8bbf\u95ee\u3002\u5bb9\u5668\u95f4\u7684\u901a\u4fe1\u4f9d\u8d56\u4e8e IP \u5730\u5740\uff0c\u8fd9\u53ef\u80fd\u5728\u52a8\u6001 IP \u5730\u5740\u7684\u60c5\u51b5\u4e0b\u5e26\u6765\u4e0d\u4fbf\u3002<\/p>\n<\/li>\n<\/ol>\n<h4>\u81ea\u5b9a\u4e49\u7f51\u7edc<\/h4>\n<p>\u81ea\u5b9a\u4e49\u7f51\u7edc\u63d0\u4f9b\u4e86\u6bd4\u9ed8\u8ba4\u7f51\u7edc\u66f4\u591a\u7684\u529f\u80fd\u548c\u7075\u6d3b\u6027\uff0c\u9002\u7528\u4e8e\u9700\u8981\u66f4\u9ad8\u63a7\u5236\u548c\u5b89\u5168\u6027\u7684\u573a\u666f\u3002<\/p>\n<ol>\n<li><strong>\u5bb9\u5668\u540d\u89e3\u6790<\/strong>\uff1a<br \/>\n\u81ea\u5b9a\u4e49\u7f51\u7edc\u652f\u6301\u5bb9\u5668\u540d\u89e3\u6790\uff0c\u5bb9\u5668\u53ef\u4ee5\u901a\u8fc7\u5bb9\u5668\u540d\u8fdb\u884c\u76f4\u63a5\u901a\u4fe1\u3002Docker \u4e3a\u52a0\u5165\u81ea\u5b9a\u4e49\u7f51\u7edc\u7684\u5bb9\u5668\u63d0\u4f9b DNS \u89e3\u6790\u670d\u52a1\uff0c\u4f7f\u5bb9\u5668\u80fd\u591f\u901a\u8fc7\u540d\u79f0\u6765\u4e92\u76f8\u8bc6\u522b\u548c\u901a\u4fe1\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u591a\u7f51\u7edc\u652f\u6301<\/strong>\uff1a<br \/>\n\u4e00\u4e2a\u5bb9\u5668\u53ef\u4ee5\u52a0\u5165\u591a\u4e2a\u7f51\u7edc\uff0c\u6bcf\u4e2a\u7f51\u7edc\u90fd\u4f1a\u5206\u914d\u4e00\u4e2a\u72ec\u7acb\u7684 IP \u5730\u5740\u3002\u8fd9\u4f7f\u5f97\u5bb9\u5668\u80fd\u591f\u8de8\u591a\u4e2a\u7f51\u7edc\u73af\u5883\u8fdb\u884c\u901a\u4fe1\u3002\u4f8b\u5982\uff0c\u5bb9\u5668\u53ef\u4ee5\u540c\u65f6\u8fde\u63a5\u5230\u4e00\u4e2a\u5185\u90e8\u7f51\u7edc\u548c\u4e00\u4e2a\u5916\u90e8\u7f51\u7edc\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u66f4\u9ad8\u7684\u7f51\u7edc\u9694\u79bb<\/strong>\uff1a<br \/>\n\u81ea\u5b9a\u4e49\u7f51\u7edc\u5141\u8bb8\u5bf9\u7f51\u7edc\u7684\u9694\u79bb\u6027\u8fdb\u884c\u66f4\u7cbe\u7ec6\u7684\u63a7\u5236\u3002\u5728\u5fae\u670d\u52a1\u67b6\u6784\u6216\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u5c06\u4e0d\u540c\u7684\u670d\u52a1\u90e8\u7f72\u5230\u4e0d\u540c\u7684\u7f51\u7edc\u4e2d\uff0c\u589e\u5f3a\u5b89\u5168\u6027\u548c\u7ba1\u7406\u7075\u6d3b\u6027\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6e\u7075\u6d3b\u6027<\/strong>\uff1a<br \/>\n\u81ea\u5b9a\u4e49\u7f51\u7edc\u652f\u6301\u66f4\u591a\u9ad8\u7ea7\u914d\u7f6e\u9009\u9879\uff0c\u5982\u81ea\u5b9a\u4e49\u5b50\u7f51\u3001\u7f51\u5173\u7b49\uff0c\u4f7f\u5f97\u7f51\u7edc\u914d\u7f6e\u66f4\u52a0\u7075\u6d3b\uff0c\u80fd\u591f\u6ee1\u8db3\u7279\u5b9a\u7684\u7f51\u7edc\u9700\u6c42\u3002<\/p>\n<\/li>\n<\/ol>\n<h3>\u7f51\u7edc\u4f7f\u7528\u793a\u4f8b<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u521b\u5efa\u81ea\u5b9a\u4e49\u7f51\u7edc\ndocker network create myapp-network\n\n# \u5728\u81ea\u5b9a\u4e49\u7f51\u7edc\u4e2d\u8fd0\u884c\u5bb9\u5668\ndocker run -d --name web1 --network myapp-network nginx\ndocker run -d --name web2 --network myapp-network nginx\n\n# \u67e5\u770b\u7f51\u7edc\u8be6\u60c5\ndocker network inspect myapp-network\n<\/code><\/pre>\n<h3>\u7f51\u7edc\u9ad8\u7ea7\u914d\u7f6e<\/h3>\n<ol>\n<li>\n<p>\u5bb9\u5668\u4e92\u8054<\/p>\n<ul>\n<li>\u540c\u4e00\u7f51\u7edc\u5185\u5bb9\u5668\u53ef\u76f4\u63a5\u901a\u8fc7\u5bb9\u5668\u540d\u901a\u4fe1<\/li>\n<li>\u81ea\u52a8DNS\u89e3\u6790<\/li>\n<li>\u7f51\u7edc\u9694\u79bb\u66f4\u5b89\u5168<\/li>\n<\/ul>\n<\/li>\n<li>\u7aef\u53e3\u6620\u5c04\n<ul>\n<li>\u5c06\u5bb9\u5668\u7aef\u53e3\u6620\u5c04\u5230\u5bbf\u4e3b\u673a<\/li>\n<li>\u5b9e\u73b0\u5916\u90e8\u8bbf\u95ee\u5bb9\u5668\u670d\u52a1<\/li>\n<\/ul>\n<pre><code class=\"language-bash line-numbers\">docker run -p 80:80 nginx\n<\/code><\/pre>\n<\/li>\n<li>\u7f51\u7edc\u522b\u540d\n<ul>\n<li>\u4e3a\u5bb9\u5668\u914d\u7f6e\u989d\u5916\u7684\u7f51\u7edc\u6807\u8bc6<\/li>\n<li>\u589e\u52a0\u7f51\u7edc\u7075\u6d3b\u6027<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>\u6700\u4f73\u5b9e\u8df5<\/h3>\n<ul>\n<li>\u4f7f\u7528\u81ea\u5b9a\u4e49\u7f51\u7edc\u4ee3\u66ff\u9ed8\u8ba4\u7f51\u7edc<\/li>\n<li>\u5408\u7406\u89c4\u5212\u7f51\u7edc\u67b6\u6784<\/li>\n<li>\u6700\u5c0f\u5316\u7f51\u7edc\u66b4\u9732<\/li>\n<li>\u4f7f\u7528\u7f51\u7edc\u522b\u540d\u7b80\u5316\u670d\u52a1\u53d1\u73b0<\/li>\n<li>\u63a7\u5236\u7aef\u53e3\u6620\u5c04\u8303\u56f4<\/li>\n<li>\u6ce8\u610f\u7f51\u7edc\u5b89\u5168\u914d\u7f6e<\/li>\n<\/ul>\n<h3>\u5e38\u89c1\u7f51\u7edc\u95ee\u9898\u6392\u67e5<\/h3>\n<ul>\n<li>\u68c0\u67e5\u5bb9\u5668\u7f51\u7edc\u914d\u7f6e<\/li>\n<li>\u9a8c\u8bc1\u7aef\u53e3\u6620\u5c04<\/li>\n<li>\u4f7f\u7528 <code>docker network inspect<\/code> \u5206\u6790\u7f51\u7edc<\/li>\n<li>\u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e<\/li>\n<li>\u786e\u8ba4\u7f51\u7edc\u6a21\u5f0f\u5339\u914d<\/li>\n<\/ul>\n<h2>Docker \u7cfb\u7edf\u8d44\u6e90\u7ba1\u7406\u547d\u4ee4<\/h2>\n<h3>docker system df<\/h3>\n<h4>\u547d\u4ee4\u63cf\u8ff0<\/h4>\n<p><code>docker system df<\/code> \u7528\u4e8e\u663e\u793a Docker \u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\uff0c\u5e2e\u52a9\u7528\u6237\u4e86\u89e3\u78c1\u76d8\u7a7a\u95f4\u5360\u7528\u60c5\u51b5\u3002<\/p>\n<h4>\u547d\u4ee4\u8bed\u6cd5<\/h4>\n<pre><code class=\"language-bash line-numbers\">docker system df [OPTIONS]\n<\/code><\/pre>\n<h4>\u5e38\u7528\u9009\u9879<\/h4>\n<ul>\n<li><code>-v<\/code> \u6216 <code>--verbose<\/code>\uff1a\u663e\u793a\u8be6\u7ec6\u7684\u7a7a\u95f4\u4f7f\u7528\u4fe1\u606f<\/li>\n<\/ul>\n<h4>\u8f93\u51fa\u4fe1\u606f<\/h4>\n<p>\u547d\u4ee4\u901a\u5e38\u4f1a\u5c55\u793a\u4ee5\u4e0b\u8d44\u6e90\u7684\u78c1\u76d8\u7a7a\u95f4\u4f7f\u7528\u60c5\u51b5\uff1a<\/p>\n<ul>\n<li>\u955c\u50cf\uff08Images\uff09<\/li>\n<li>\u5bb9\u5668\uff08Containers\uff09<\/li>\n<li>\u6570\u636e\u5377\uff08Volumes\uff09<\/li>\n<\/ul>\n<h4>\u4f7f\u7528\u793a\u4f8b<\/h4>\n<pre><code class=\"language-bash line-numbers\"># \u67e5\u770b Docker \u7cfb\u7edf\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\ndocker system df\n\n# \u67e5\u770b\u8be6\u7ec6\u7684\u7a7a\u95f4\u4f7f\u7528\u4fe1\u606f\ndocker system df -v\n<\/code><\/pre>\n<h4>\u5178\u578b\u8f93\u51fa<\/h4>\n<table>\n<thead>\n<tr>\n<th>\u7c7b\u578b<\/th>\n<th>\u603b\u8ba1<\/th>\n<th>\u6d3b\u8dc3<\/th>\n<th>\u5360\u7528\u7a7a\u95f4<\/th>\n<th>\u53ef\u56de\u6536\u7a7a\u95f4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Images<\/td>\n<td>10<\/td>\n<td>5<\/td>\n<td>2.5GB<\/td>\n<td>1.2GB<\/td>\n<\/tr>\n<tr>\n<td>Containers<\/td>\n<td>15<\/td>\n<td>8<\/td>\n<td>500MB<\/td>\n<td>200MB<\/td>\n<\/tr>\n<tr>\n<td>Volumes<\/td>\n<td>7<\/td>\n<td>5<\/td>\n<td>2GB<\/td>\n<td>500MB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u5e94\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u68c0\u67e5\u78c1\u76d8\u7a7a\u95f4\u5360\u7528<\/li>\n<li>\u8bc6\u522b\u53ef\u4ee5\u6e05\u7406\u7684\u8d44\u6e90<\/li>\n<li>\u8fdb\u884c\u7cfb\u7edf\u8d44\u6e90\u7ba1\u7406<\/li>\n<\/ul>\n<h3>docker builder prune -f<\/h3>\n<h4>\u547d\u4ee4\u63cf\u8ff0<\/h4>\n<p><code>docker builder prune -f<\/code> \u7528\u4e8e\u6e05\u7406\u6784\u5efa\u8fc7\u7a0b\u4e2d\u7684\u7f13\u5b58\uff0c\u5e2e\u52a9\u91ca\u653e\u78c1\u76d8\u7a7a\u95f4\u3002<\/p>\n<h4>\u547d\u4ee4\u8bed\u6cd5<\/h4>\n<pre><code class=\"language-bash line-numbers\">docker builder prune [OPTIONS]\n<\/code><\/pre>\n<h4>\u5e38\u7528\u9009\u9879<\/h4>\n<ul>\n<li><code>-f<\/code> \u6216 <code>--force<\/code>\uff1a\u5f3a\u5236\u5220\u9664\uff0c\u4e0d\u8fdb\u884c\u786e\u8ba4<\/li>\n<li><code>--all<\/code>\uff1a\u5220\u9664\u6240\u6709\u672a\u4f7f\u7528\u7684\u6784\u5efa\u7f13\u5b58<\/li>\n<li><code>--filter<\/code>\uff1a\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u8fc7\u6ee4\u8981\u5220\u9664\u7684\u7f13\u5b58<\/li>\n<\/ul>\n<h4>\u4f7f\u7528\u793a\u4f8b<\/h4>\n<pre><code class=\"language-bash line-numbers\"># \u5f3a\u5236\u5220\u9664\u672a\u4f7f\u7528\u7684\u6784\u5efa\u7f13\u5b58\ndocker builder prune -f\n\n# \u5220\u9664\u6240\u6709\u672a\u4f7f\u7528\u7684\u6784\u5efa\u7f13\u5b58\ndocker builder prune --all\n\n# \u5220\u9664\u7279\u5b9a\u65f6\u95f4\u4e4b\u524d\u7684\u7f13\u5b58\ndocker builder prune --filter \"until=24h\"\n<\/code><\/pre>\n<h4>\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>\u5220\u9664\u7f13\u5b58\u53ef\u4ee5\u91ca\u653e\u78c1\u76d8\u7a7a\u95f4<\/li>\n<li>\u4e0b\u6b21\u6784\u5efa\u955c\u50cf\u65f6\u53ef\u80fd\u4f1a\u589e\u52a0\u6784\u5efa\u65f6\u95f4<\/li>\n<li>\u8c28\u614e\u4f7f\u7528 <code>-f<\/code> \u9009\u9879\uff0c\u907f\u514d\u610f\u5916\u5220\u9664\u91cd\u8981\u7f13\u5b58<\/li>\n<\/ul>\n<h4>\u5e94\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u6e05\u7406\u78c1\u76d8\u7a7a\u95f4<\/li>\n<li>\u91cd\u7f6e\u6784\u5efa\u7f13\u5b58<\/li>\n<li>\u7ba1\u7406 Docker \u6784\u5efa\u73af\u5883<\/li>\n<\/ul>\n<h1>\u9ad8\u7ea7\u7bc7<\/h1>\n<h2>Kubernetes\uff08K8s\uff09<\/h2>\n<p>Kubernetes\uff08\u7b80\u79f0K8s\uff09\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\uff0c\u7528\u4e8e\u81ea\u52a8\u5316\u5bb9\u5668\u7684\u90e8\u7f72\u3001\u6269\u5c55\u548c\u7ba1\u7406\u3002\u5b83\u5728\u5bb9\u5668\u5316\u5e94\u7528\u7684\u751f\u547d\u5468\u671f\u7ba1\u7406\u4e2d\u8d77\u7740\u81f3\u5173\u91cd\u8981\u7684\u4f5c\u7528\uff0c\u7279\u522b\u662f\u5f53\u5bb9\u5668\u6570\u91cf\u548c\u590d\u6742\u5ea6\u589e\u52a0\u65f6\uff0cK8s \u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u548c\u529f\u80fd\u6765\u4fdd\u6301\u5e94\u7528\u7684\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002<\/p>\n<h3>1. K8s \u6838\u5fc3\u6982\u5ff5<\/h3>\n<p>Kubernetes \u7684\u57fa\u672c\u7ed3\u6784\u5305\u62ec\u51e0\u4e2a\u91cd\u8981\u7684\u6982\u5ff5\u548c\u7ec4\u4ef6\uff0c\u5b83\u4eec\u662f\u5b9e\u73b0\u5bb9\u5668\u7f16\u6392\u548c\u7ba1\u7406\u7684\u57fa\u7840\u3002<\/p>\n<ul>\n<li><strong>Pod<\/strong>: \u6700\u5c0f\u7684\u90e8\u7f72\u5355\u4f4d\uff0c\u4e00\u4e2a Pod \u4ee3\u8868\u4e00\u7ec4\u8fd0\u884c\u5728\u540c\u4e00\u4e3b\u673a\u4e0a\u7684\u5bb9\u5668\u3002Pod \u5185\u7684\u5bb9\u5668\u5171\u4eab\u7f51\u7edc\u548c\u5b58\u50a8\u8d44\u6e90\u3002<\/li>\n<li><strong>Node<\/strong>: K8s \u96c6\u7fa4\u4e2d\u7684\u6bcf\u53f0\u7269\u7406\u6216\u865a\u62df\u673a\u90fd\u88ab\u79f0\u4e3a Node\u3002\u8282\u70b9\u4e0a\u8fd0\u884c Pod \u548c\u5bb9\u5668\u3002<\/li>\n<li><strong>Cluster<\/strong>: \u7531\u4e00\u7ec4 Node \u7ec4\u6210\uff0cK8s \u63a7\u5236\u5e73\u9762\uff08Control Plane\uff09\u8d1f\u8d23\u7ba1\u7406\u96c6\u7fa4\u3002<\/li>\n<li><strong>Deployment<\/strong>: \u63a7\u5236 Pod \u7684\u521b\u5efa\u548c\u7ba1\u7406\uff0c\u7528\u4e8e\u58f0\u660e\u5e94\u7528\u7a0b\u5e8f\u7684\u671f\u671b\u72b6\u6001\uff0c\u5e76\u786e\u4fdd\u96c6\u7fa4\u4fdd\u6301\u8be5\u72b6\u6001\u3002<\/li>\n<li><strong>Service<\/strong>: \u4e3a Pod \u63d0\u4f9b\u7a33\u5b9a\u7684\u8bbf\u95ee\u5165\u53e3\uff0c\u652f\u6301\u8d1f\u8f7d\u5747\u8861\u548c\u53d1\u73b0\u670d\u52a1\u3002<\/li>\n<li><strong>Namespace<\/strong>: \u7528\u4e8e\u5728\u540c\u4e00\u4e2a\u96c6\u7fa4\u5185\u5c06\u8d44\u6e90\u5212\u5206\u6210\u4e0d\u540c\u7684\u9694\u79bb\u533a\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u540d\u7a7a\u95f4\u7ec4\u7ec7\u548c\u7ba1\u7406\u96c6\u7fa4\u4e2d\u7684\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<h3>2. K8s \u6838\u5fc3\u7ec4\u4ef6<\/h3>\n<p>Kubernetes \u7531\u63a7\u5236\u5e73\u9762\u548c\u5de5\u4f5c\u8282\u70b9\u7ec4\u6210\uff0c\u5176\u4e2d\u5305\u542b\u591a\u4e2a\u7ec4\u4ef6\u6765\u5b8c\u6210\u4e0d\u540c\u7684\u529f\u80fd\u3002<\/p>\n<ul>\n<li><strong>API Server<\/strong>: \u63d0\u4f9b Kubernetes \u96c6\u7fa4\u7684 REST API \u63a5\u53e3\uff0c\u6240\u6709\u7ba1\u7406\u8bf7\u6c42\u90fd\u901a\u8fc7\u5b83\u8fdb\u884c\u3002<\/li>\n<li><strong>Scheduler<\/strong>: \u8d1f\u8d23\u5c06 Pod \u5206\u914d\u5230\u5408\u9002\u7684\u8282\u70b9\u4e0a\u6267\u884c\uff0c\u4f9d\u636e\u8d44\u6e90\u5229\u7528\u7387\u548c\u8c03\u5ea6\u7b56\u7565\u3002<\/li>\n<li><strong>Controller Manager<\/strong>: \u7ba1\u7406\u96c6\u7fa4\u4e2d\u7684\u63a7\u5236\u5668\uff0c\u5982 Deployment Controller\u3001ReplicaSet Controller\u3001Job Controller \u7b49\u3002<\/li>\n<li><strong>Kubelet<\/strong>: \u6bcf\u4e2a\u8282\u70b9\u4e0a\u7684\u4ee3\u7406\uff0c\u8d1f\u8d23\u786e\u4fdd\u5bb9\u5668\u548c Pod \u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/li>\n<li><strong>etcd<\/strong>: \u4e00\u4e2a\u5206\u5e03\u5f0f\u952e\u503c\u5b58\u50a8\u7cfb\u7edf\uff0c\u4fdd\u5b58 Kubernetes \u96c6\u7fa4\u7684\u6240\u6709\u914d\u7f6e\u6570\u636e\u548c\u72b6\u6001\u3002<\/li>\n<li><strong>Cloud Controller Manager<\/strong>: \u63d0\u4f9b\u96c6\u7fa4\u4e0e\u4e91\u5e73\u53f0\uff08\u5982 AWS\u3001GCP\uff09\u7684\u96c6\u6210\u3002<\/li>\n<\/ul>\n<h3>3. Kubernetes \u64cd\u4f5c<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>kubectl get pods<\/code><\/td>\n<td>\u5217\u51fa\u6240\u6709 Pod<\/td>\n<td><code>kubectl get pods<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl describe pod [Pod\u540d\u79f0]<\/code><\/td>\n<td>\u67e5\u770b Pod \u8be6\u7ec6\u4fe1\u606f<\/td>\n<td><code>kubectl describe pod myapp-pod<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl apply -f [YAML\u6587\u4ef6]<\/code><\/td>\n<td>\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u521b\u5efa\u6216\u66f4\u65b0\u8d44\u6e90<\/td>\n<td><code>kubectl apply -f deployment.yaml<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl delete pod [Pod\u540d\u79f0]<\/code><\/td>\n<td>\u5220\u9664\u6307\u5b9a Pod<\/td>\n<td><code>kubectl delete pod myapp-pod<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl scale deployment [\u90e8\u7f72\u540d\u79f0] --replicas=[\u526f\u672c\u6570]<\/code><\/td>\n<td>\u6269\u5c55\u6216\u7f29\u51cf\u526f\u672c\u6570<\/td>\n<td><code>kubectl scale deployment myapp --replicas=5<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl logs [Pod\u540d\u79f0]<\/code><\/td>\n<td>\u67e5\u770b Pod \u65e5\u5fd7<\/td>\n<td><code>kubectl logs myapp-pod<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>kubectl port-forward [Pod\u540d\u79f0] [\u672c\u5730\u7aef\u53e3]:[Pod\u7aef\u53e3]<\/code><\/td>\n<td>\u7aef\u53e3\u8f6c\u53d1<\/td>\n<td><code>kubectl port-forward myapp-pod 8080:80<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>4. \u5e38\u89c1\u7684 Kubernetes \u8d44\u6e90<\/h3>\n<ul>\n<li><strong>Pod<\/strong>: \u5bb9\u5668\u8fd0\u884c\u7684\u57fa\u672c\u5355\u4f4d\u3002<\/li>\n<li><strong>Deployment<\/strong>: \u7528\u4e8e\u7ba1\u7406 Pod \u7684\u526f\u672c\uff0c\u786e\u4fdd\u6307\u5b9a\u6570\u91cf\u7684 Pod \u526f\u672c\u59cb\u7ec8\u8fd0\u884c\u3002<\/li>\n<li><strong>ReplicaSet<\/strong>: \u786e\u4fdd\u4e00\u4e2a\u7279\u5b9a\u6570\u91cf\u7684 Pod \u526f\u672c\u5728\u4efb\u4f55\u65f6\u5019\u90fd\u5728\u8fd0\u884c\u3002<\/li>\n<li><strong>Service<\/strong>: \u63d0\u4f9b\u8d1f\u8f7d\u5747\u8861\u548c\u670d\u52a1\u53d1\u73b0\u3002<\/li>\n<li><strong>Ingress<\/strong>: \u7ba1\u7406\u5916\u90e8\u8bbf\u95ee\u5230\u96c6\u7fa4\u5185\u670d\u52a1\u7684\u89c4\u5219\uff0c\u652f\u6301 HTTP \u548c HTTPS \u8def\u7531\u3002<\/li>\n<li><strong>ConfigMap<\/strong>: \u5b58\u50a8\u975e\u654f\u611f\u7684\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<li><strong>Secret<\/strong>: \u5b58\u50a8\u654f\u611f\u6570\u636e\uff0c\u5982\u5bc6\u7801\u3001Token \u7b49\u3002<\/li>\n<li><strong>StatefulSet<\/strong>: \u7528\u4e8e\u7ba1\u7406\u6709\u72b6\u6001\u5e94\u7528\uff0c\u4fdd\u8bc1 Pod \u7684\u987a\u5e8f\u548c\u6301\u4e45\u5316\u5b58\u50a8\u3002<\/li>\n<li><strong>Job<\/strong>: \u7528\u4e8e\u6279\u91cf\u4efb\u52a1\u7684\u7ba1\u7406\uff0c\u6267\u884c\u4e00\u6b21\u6027\u4efb\u52a1\u3002<\/li>\n<li><strong>CronJob<\/strong>: \u5b9a\u65f6\u4efb\u52a1\uff0c\u57fa\u4e8e Cron \u8868\u8fbe\u5f0f\u5b9a\u65f6\u6267\u884c\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<h3>5. \u5b9e\u6218\u6848\u4f8b<\/h3>\n<h4>\u90e8\u7f72\u4e00\u4e2a\u7b80\u5355\u7684 Nginx \u5e94\u7528<\/h4>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a <code>nginx-deployment.yaml<\/code> \u914d\u7f6e\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:latest\n        ports:\n        - containerPort: 80\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u4f7f\u7528 <code>kubectl<\/code> \u521b\u5efa Deployment\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-bash line-numbers\">kubectl apply -f nginx-deployment.yaml\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u521b\u5efa\u4e00\u4e2a Service \u4ee5\u66b4\u9732 Nginx \u670d\u52a1\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: v1\nkind: Service\nmetadata:\n  name: nginx-service\nspec:\n  selector:\n    app: nginx\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 80\n  type: LoadBalancer\n<\/code><\/pre>\n<ol start=\"4\">\n<li>\u90e8\u7f72 Service\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-bash line-numbers\">kubectl apply -f nginx-service.yaml\n<\/code><\/pre>\n<ol start=\"5\">\n<li>\u67e5\u770b\u670d\u52a1\uff1a<\/li>\n<\/ol>\n<pre><code class=\"language-bash line-numbers\">kubectl get svc nginx-service\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u4f60\u5c31\u53ef\u4ee5\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\u7684\u65b9\u5f0f\u8bbf\u95ee\u591a\u4e2a Nginx \u5b9e\u4f8b\u3002<\/p>\n<h3>6. \u9ad8\u7ea7\u7279\u6027<\/h3>\n<ul>\n<li><strong>Horizontal Pod Autoscaling<\/strong>: \u6839\u636e CPU \u4f7f\u7528\u7387\u6216\u5176\u4ed6\u6307\u6807\u81ea\u52a8\u8c03\u6574 Pod \u6570\u91cf\u3002<\/li>\n<li><strong>Pod Disruption Budgets (PDB)<\/strong>: \u786e\u4fdd\u5728\u8fdb\u884c\u6eda\u52a8\u66f4\u65b0\u65f6\uff0c\u96c6\u7fa4\u4e2d\u59cb\u7ec8\u6709\u8db3\u591f\u7684 Pod \u5b58\u6d3b\u3002<\/li>\n<li><strong>Persistent Volumes (PV)<\/strong> \u548c <strong>Persistent Volume Claims (PVC)<\/strong>: \u7528\u4e8e\u7ba1\u7406\u5b58\u50a8\uff0c\u786e\u4fdd\u6570\u636e\u5728 Pod \u91cd\u542f\u6216\u8fc1\u79fb\u65f6\u4e0d\u4e22\u5931\u3002<\/li>\n<li><strong>Helm<\/strong>: \u4e00\u4e2a Kubernetes \u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u90e8\u7f72\u548c\u7ba1\u7406\u590d\u6742\u7684\u5e94\u7528\u3002<\/li>\n<li><strong>Operators<\/strong>: \u81ea\u5b9a\u4e49\u63a7\u5236\u5668\uff0c\u7528\u4e8e\u7ba1\u7406\u590d\u6742\u7684\u6709\u72b6\u6001\u5e94\u7528\uff0c\u7b80\u5316\u5e94\u7528\u90e8\u7f72\u548c\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<h1>\u6700\u7ec8\u7bc7<\/h1>\n<h1>\u5b66\u4e60\u8def\u5f84\u63a8\u8350<\/h1>\n<ul>\n<li><strong>\u5165\u95e8<\/strong>\uff1a\u638c\u63e1\u57fa\u672c\u547d\u4ee4\u548c\u6982\u5ff5<\/li>\n<li><strong>\u8fdb\u9636<\/strong>\uff1aDocker Compose\u4e0e\u7f51\u7edc\u3001\u6570\u636e\u5377\u7ba1\u7406<\/li>\n<li><strong>\u9ad8\u7ea7<\/strong>\uff1a\u5bb9\u5668\u7f16\u6392\uff08Kubernetes\uff09<\/li>\n<li><strong>\u5b9e\u6218<\/strong>\uff1a\u770b\u5341\u904d\u4e0d\u5982\u52a8\u624b\u4e00\u904d<\/li>\n<\/ul>\n<hr \/>\n<p>\u5e0c\u671b\u8fd9\u4efd\u6587\u6863\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u4f7f\u7528 Docker\uff01\ud83d\udc33<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728\u6570\u5b57\u65f6\u4ee3\uff0c\u81ea\u52a8\u5316\u6280\u672f\u6b63\u6084\u7136\u6539\u53d8\u6211\u4eec\u7684\u751f\u6d3b\u548c\u5de5\u4f5c\u65b9\u5f0f\u3002\u672c\u6587\u5c06\u63a2\u8ba8\u81ea\u52a8\u5316\u5982\u4f55\u901a\u8fc7\u63d0\u9ad8\u6548\u7387\u548c\u51cf\u5c11\u4eba\u4e3a\u9519\u8bef\uff0c\u5851\u9020\u672a\u6765\u7684\u804c\u4e1a\u683c\u5c40\u3002\u4f60\u662f\u5426\u60f3\u77e5\u9053\uff0c\u81ea\u52a8\u5316\u662f\u5426\u4f1a\u53d6\u4ee3\u73b0\u5b9e\u4e2d\u7684\u5de5\u4f5c\uff0c\u8fd8\u662f\u4f1a\u521b\u9020\u51fa\u65b0\u7684\u673a\u9047\uff1f\u8ba9\u6211\u4eec\u4e00\u8d77\u63ed\u5f00\u8fd9\u4e2a\u5f15\u4eba\u5165\u80dc\u7684\u8bdd\u9898","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[16],"tags":[17,19,18,21,22,20],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-docker","tag-docker","tag-k8s","tag-kubernetes","tag-21","tag-22","tag-20"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-\u5165\u95e8\u6307\u5357\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357\" \/>\n<meta property=\"og:description\" content=\"\u7b80\u4ecb Docker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u5316\u5e73\u53f0\uff0c\u9769\u547d\u6027\u5730\u7b80\u5316\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u90e8\u7f72\u548c\u7ba1\u7406\u3002\u60f3\u8c61\u5b83\u5c31\u50cf\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684&quot;\u642c\u5bb6\u4e13\u5bb6&quot;\uff0c\u80fd\u5c06\u5e94\u7528\u7a0b\u5e8f ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-\u5165\u95e8\u6307\u5357\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4ee3\u7801\u604b\u7231\u6307\u5357\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-09T13:24:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-22T10:53:30+00:00\" \/>\n<meta name=\"author\" content=\"beizou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"beizou\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/\"},\"author\":{\"name\":\"beizou\",\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737\"},\"headline\":\"Docker \u5165\u95e8\u6307\u5357\",\"datePublished\":\"2024-12-09T13:24:46+00:00\",\"dateModified\":\"2024-12-22T10:53:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/\"},\"wordCount\":192,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737\"},\"keywords\":[\"Docker\",\"K8s\",\"Kubernetes\",\"\u5bb9\u5668\u5316\",\"\u8d1f\u8f7d\u5747\u8861\",\"\u8fd0\u7ef4\u6280\u672f\"],\"articleSection\":[\"Docker\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/\",\"url\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/\",\"name\":\"Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357\",\"isPartOf\":{\"@id\":\"https:\/\/codeloveme.com\/#website\"},\"datePublished\":\"2024-12-09T13:24:46+00:00\",\"dateModified\":\"2024-12-22T10:53:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/codeloveme.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docker \u5165\u95e8\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codeloveme.com\/#website\",\"url\":\"https:\/\/codeloveme.com\/\",\"name\":\"\u4ee3\u7801\u604b\u7231\u6307\u5357\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codeloveme.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737\",\"name\":\"beizou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/codeloveme.com\/wp-content\/uploads\/2024\/11\/\u540e\u85e4\u72ec.jpg\",\"contentUrl\":\"https:\/\/codeloveme.com\/wp-content\/uploads\/2024\/11\/\u540e\u85e4\u72ec.jpg\",\"width\":1080,\"height\":1060,\"caption\":\"beizou\"},\"logo\":{\"@id\":\"https:\/\/codeloveme.com\/#\/schema\/person\/image\/\"},\"description\":\"\u5f31\u70b9\uff1a\u7231\u60c5 \u4f18\u70b9\uff1a\u6ca1\u6709\u7231\u60c5\",\"sameAs\":[\"http:\/\/codeloveme.com\"],\"url\":\"https:\/\/codeloveme.com\/index.php\/author\/beizou\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-\u5165\u95e8\u6307\u5357\/","og_locale":"zh_CN","og_type":"article","og_title":"Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357","og_description":"\u7b80\u4ecb Docker \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5bb9\u5668\u5316\u5e73\u53f0\uff0c\u9769\u547d\u6027\u5730\u7b80\u5316\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u90e8\u7f72\u548c\u7ba1\u7406\u3002\u60f3\u8c61\u5b83\u5c31\u50cf\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\"\u642c\u5bb6\u4e13\u5bb6\"\uff0c\u80fd\u5c06\u5e94\u7528\u7a0b\u5e8f ...","og_url":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-\u5165\u95e8\u6307\u5357\/","og_site_name":"\u4ee3\u7801\u604b\u7231\u6307\u5357","article_published_time":"2024-12-09T13:24:46+00:00","article_modified_time":"2024-12-22T10:53:30+00:00","author":"beizou","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"beizou","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#article","isPartOf":{"@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/"},"author":{"name":"beizou","@id":"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737"},"headline":"Docker \u5165\u95e8\u6307\u5357","datePublished":"2024-12-09T13:24:46+00:00","dateModified":"2024-12-22T10:53:30+00:00","mainEntityOfPage":{"@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/"},"wordCount":192,"commentCount":0,"publisher":{"@id":"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737"},"keywords":["Docker","K8s","Kubernetes","\u5bb9\u5668\u5316","\u8d1f\u8f7d\u5747\u8861","\u8fd0\u7ef4\u6280\u672f"],"articleSection":["Docker"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/","url":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/","name":"Docker \u5165\u95e8\u6307\u5357 - \u4ee3\u7801\u604b\u7231\u6307\u5357","isPartOf":{"@id":"https:\/\/codeloveme.com\/#website"},"datePublished":"2024-12-09T13:24:46+00:00","dateModified":"2024-12-22T10:53:30+00:00","breadcrumb":{"@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/codeloveme.com\/index.php\/2024\/12\/09\/docker-%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/codeloveme.com\/"},{"@type":"ListItem","position":2,"name":"Docker \u5165\u95e8\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/codeloveme.com\/#website","url":"https:\/\/codeloveme.com\/","name":"\u4ee3\u7801\u604b\u7231\u6307\u5357","description":"","publisher":{"@id":"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codeloveme.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/codeloveme.com\/#\/schema\/person\/81a4181217586206bf536360ebdbc737","name":"beizou","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/codeloveme.com\/#\/schema\/person\/image\/","url":"https:\/\/codeloveme.com\/wp-content\/uploads\/2024\/11\/\u540e\u85e4\u72ec.jpg","contentUrl":"https:\/\/codeloveme.com\/wp-content\/uploads\/2024\/11\/\u540e\u85e4\u72ec.jpg","width":1080,"height":1060,"caption":"beizou"},"logo":{"@id":"https:\/\/codeloveme.com\/#\/schema\/person\/image\/"},"description":"\u5f31\u70b9\uff1a\u7231\u60c5 \u4f18\u70b9\uff1a\u6ca1\u6709\u7231\u60c5","sameAs":["http:\/\/codeloveme.com"],"url":"https:\/\/codeloveme.com\/index.php\/author\/beizou\/"}]}},"_links":{"self":[{"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":11,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":179,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/posts\/176\/revisions\/179"}],"wp:attachment":[{"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeloveme.com\/index.php\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}