{"id":96477,"date":"2026-08-27T18:16:36","date_gmt":"2026-08-27T10:16:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/96477.html"},"modified":"2026-08-27T18:16:36","modified_gmt":"2026-08-27T10:16:36","slug":"05-dockerfile-%e7%bc%96%e5%86%99%e5%ae%9e%e6%88%98%ef%bc%9a%e6%8a%8a%e8%87%aa%e5%b7%b1%e7%9a%84-python-node-js-%e5%ba%94%e7%94%a8%e6%89%93%e5%8c%85%e6%88%90%e9%95%9c%e5%83%8f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/96477.html","title":{"rendered":"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf"},"content":{"rendered":"<h2>05. Dockerfile \u7f16\u5199\u5b9e\u6218&#xff1a;\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf<\/h2>\n<p>\u524d\u9762\u51e0\u7bc7\u6587\u7ae0\u6211\u4eec\u90fd\u5728\u7528\u522b\u4eba\u505a\u597d\u7684\u955c\u50cf&#xff0c;docker pull nginx\u3001docker pull python\u2026\u2026\u4f46\u6bcf\u6b21\u90fd\u5f97\u624b\u52a8\u8fdb\u5bb9\u5668\u6539\u914d\u7f6e\u3001\u88c5\u4f9d\u8d56\u3001\u62f7\u4ee3\u7801&#xff0c;\u592a\u8d39\u52b2\u4e86\u3002\u80fd\u4e0d\u80fd\u628a\u6211\u5199\u597d\u7684\u5e94\u7528\u76f4\u63a5\u6253\u5305\u6210\u4e00\u4e2a\u955c\u50cf&#xff0c;\u4ee5\u540e docker run \u4e00\u628a\u68ad\u5c31\u8dd1\u8d77\u6765&#xff1f;\u4eca\u5929\u5c31\u6765\u641e\u5b9a\u8fd9\u4ef6\u4e8b\u2014\u2014\u5b66\u4f1a\u5199 Dockerfile&#xff0c;\u8ba9\u4f60\u7684\u5e94\u7528\u4e5f\u80fd\u53d8\u6210 Docker \u955c\u50cf\u3002<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1152\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827101634-6a900e82a19c7.jpg\" width=\"2048\" \/><\/p>\n<p>\u25b2 \u522b\u628a Dockerfile \u5f53\u590d\u6742\u8bed\u6cd5&#xff0c;\u5b83\u5c31\u50cf\u4e00\u4efd&#034;\u83dc\u8c31&#034;&#xff1a;\u57fa\u7840\u955c\u50cf\u3001\u5de5\u4f5c\u76ee\u5f55\u3001\u4f9d\u8d56\u3001\u4ee3\u7801\u3001\u542f\u52a8\u547d\u4ee4&#xff0c;\u7167\u7740\u4e00\u6b65\u6b65\u6765\u5c31\u80fd&#034;\u51fa\u9505&#034;\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001Dockerfile \u662f\u4ec0\u4e48&#xff1f;\u4e00\u4efd&#034;\u83dc\u8c31&#034;<\/h3>\n<p>\u4f60\u53ef\u4ee5\u628a Dockerfile \u60f3\u8c61\u6210\u4e00\u4efd\u83dc\u8c31&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f60\u544a\u8bc9 Docker&#xff1a;&#034;\u5148\u51c6\u5907\u4ec0\u4e48\u98df\u6750&#xff08;\u57fa\u7840\u955c\u50cf&#xff09;\u3001\u7528\u4ec0\u4e48\u9505&#xff08;\u5de5\u4f5c\u76ee\u5f55&#xff09;\u3001\u653e\u4ec0\u4e48\u8c03\u6599&#xff08;\u4f9d\u8d56&#xff09;\u3001\u52a0\u4ec0\u4e48\u4e3b\u83dc&#xff08;\u5e94\u7528\u4ee3\u7801&#xff09;\u3001\u6700\u540e\u600e\u4e48\u4e0a\u83dc&#xff08;\u542f\u52a8\u547d\u4ee4&#xff09;&#034;<\/p>\n<\/li>\n<li>\n<p>Docker \u7167\u7740\u8fd9\u4efd\u83dc\u8c31\u4e00\u6b65\u6b65\u6267\u884c&#xff0c;\u6700\u540e\u7ed9\u4f60\u505a\u51fa\u4e00\u9053\u5b8c\u6574\u7684&#034;\u83dc&#034;\u2014\u2014\u4e5f\u5c31\u662f\u4e00\u4e2a\u955c\u50cf<\/p>\n<\/li>\n<\/ul>\n<p>\u6280\u672f\u4e0a\u8bf4&#xff0c;Dockerfile \u662f\u4e00\u4e2a\u7eaf\u6587\u672c\u6587\u4ef6&#xff08;\u5c31\u53eb Dockerfile&#xff0c;\u6ca1\u6709\u6269\u5c55\u540d&#xff09;&#xff0c;\u91cc\u9762\u5199\u6ee1\u4e86 Docker \u80fd\u8bc6\u522b\u7684\u6307\u4ee4\u3002\u4f60\u7528 docker build \u547d\u4ee4\u544a\u8bc9 Docker &#034;\u7167\u7740\u8fd9\u4e2a\u6587\u4ef6\u6784\u5efa\u955c\u50cf&#034;&#xff0c;\u5b83\u5c31\u4f1a\u9010\u884c\u6267\u884c\u8fd9\u4e9b\u6307\u4ee4\u3002<\/p>\n<p>\u4e00\u53e5\u8bdd&#xff1a;Dockerfile \u662f\u955c\u50cf\u7684\u6e90\u4ee3\u7801&#xff0c;\u955c\u50cf\u662f Dockerfile \u7f16\u8bd1\u540e\u7684\u4ea7\u7269\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5e38\u7528\u6307\u4ee4\u901f\u67e5\u8868<\/h3>\n<p>\u5148\u6df7\u4e2a\u8138\u719f&#xff0c;\u540e\u9762\u4f1a\u4e00\u4e2a\u4e2a\u8be6\u7ec6\u8bb2&#xff1a;<\/p>\n<table>\n<tr>\u6307\u4ee4\u4f5c\u7528\u7c7b\u6bd4<\/tr>\n<tbody>\n<tr>\n<td>FROM<\/td>\n<td>\u6307\u5b9a\u57fa\u7840\u955c\u50cf<\/td>\n<td>\u9009\u4e2a\u9505<\/td>\n<\/tr>\n<tr>\n<td>WORKDIR<\/td>\n<td>\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<\/td>\n<td>\u8fdb\u53a8\u623f<\/td>\n<\/tr>\n<tr>\n<td>COPY<\/td>\n<td>\u590d\u5236\u6587\u4ef6\u5230\u955c\u50cf<\/td>\n<td>\u653e\u98df\u6750<\/td>\n<\/tr>\n<tr>\n<td>ADD<\/td>\n<td>\u590d\u5236\u6587\u4ef6&#xff08;\u652f\u6301\u81ea\u52a8\u89e3\u538b tar&#xff09;<\/td>\n<td>\u653e\u98df\u6750&#043;\u5f00\u7f50\u5934<\/td>\n<\/tr>\n<tr>\n<td>RUN<\/td>\n<td>\u6267\u884c\u547d\u4ee4&#xff08;\u88c5\u8f6f\u4ef6\u3001\u7f16\u8bd1\u7b49&#xff09;<\/td>\n<td>\u70f9\u996a\u8fc7\u7a0b<\/td>\n<\/tr>\n<tr>\n<td>ENV<\/td>\n<td>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/td>\n<td>\u8c03\u53e3\u5473<\/td>\n<\/tr>\n<tr>\n<td>EXPOSE<\/td>\n<td>\u58f0\u660e\u7aef\u53e3\u53f7&#xff08;\u4ec5\u6587\u6863\u8bf4\u660e&#xff09;<\/td>\n<td>\u8d34\u6807\u7b7e<\/td>\n<\/tr>\n<tr>\n<td>CMD<\/td>\n<td>\u5bb9\u5668\u542f\u52a8\u65f6\u6267\u884c\u7684\u9ed8\u8ba4\u547d\u4ee4<\/td>\n<td>\u4e0a\u83dc\u65b9\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>ENTRYPOINT<\/td>\n<td>\u5bb9\u5668\u542f\u52a8\u65f6\u6267\u884c\u7684\u4e3b\u547d\u4ee4<\/td>\n<td>\u56fa\u5b9a\u83dc\u54c1<\/td>\n<\/tr>\n<tr>\n<td>ARG<\/td>\n<td>\u6784\u5efa\u65f6\u53d8\u91cf&#xff08;\u8fd0\u884c\u65f6\u4e0d\u53ef\u7528&#xff09;<\/td>\n<td>\u53a8\u5e08\u5907\u6ce8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e09\u3001\u5e38\u7528\u6307\u4ee4\u8be6\u89e3&#xff08;\u6bcf\u6761\u90fd\u6709\u793a\u4f8b&#xff09;<\/h3>\n<h4>3.1 FROM&#xff1a;\u6307\u5b9a\u57fa\u7840\u955c\u50cf<\/h4>\n<p>\u6bcf\u6761 Dockerfile \u7684\u7b2c\u4e00\u884c\u5fc5\u987b\u662f FROM\u3002 \u5b83\u51b3\u5b9a\u4e86\u4f60\u7684\u955c\u50cf&#034;\u7ad9\u5728\u8c01\u7684\u80a9\u8180\u4e0a&#034;&#xff1a;<\/p>\n<p># Python \u5e94\u7528\u5e38\u7528<br \/>\nFROM python:3.11-slim<br \/>\n\u200b<br \/>\n# Node.js \u5e94\u7528\u5e38\u7528<br \/>\nFROM node:20-alpine<br \/>\n\u200b<br \/>\n# \u6781\u7b80\u573a\u666f&#xff08;\u53ea\u8dd1\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6&#xff09;<br \/>\nFROM alpine:3.19<br \/>\n\u200b<br \/>\n# Java \u5e94\u7528<br \/>\nFROM eclipse-temurin:17-jdk-alpine<\/p>\n<p>\u9009\u955c\u50cf\u7248\u672c\u7684\u6280\u5de7&#xff1a;<\/p>\n<table>\n<tr>\u6807\u7b7e\u4f53\u79ef\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>latest<\/td>\n<td>\u8f83\u5927<\/td>\n<td>\u4e0d\u63a8\u8350\u751f\u4ea7\u4f7f\u7528&#xff08;\u7248\u672c\u4e0d\u56fa\u5b9a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>3.11<\/td>\n<td>\u4e2d\u7b49<\/td>\n<td>\u5f00\u53d1\u8c03\u8bd5\u591f\u7528<\/td>\n<\/tr>\n<tr>\n<td>3.11-slim<\/td>\n<td>\u5c0f&#xff08;\u7ea6 120MB&#xff09;<\/td>\n<td>\u63a8\u8350\u751f\u4ea7\u73af\u5883<\/td>\n<\/tr>\n<tr>\n<td>3.11-alpine<\/td>\n<td>\u6781\u5c0f&#xff08;\u7ea6 50MB&#xff09;<\/td>\n<td>\u8ffd\u6c42\u6781\u81f4\u4f53\u79ef&#xff08;\u4f46\u67d0\u4e9b\u5e93\u7f16\u8bd1\u4f1a\u62a5\u9519&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5efa\u8bae&#xff1a;\u751f\u4ea7\u73af\u5883\u7528 -slim \u7248\u672c&#xff0c;\u517c\u987e\u4f53\u79ef\u548c\u517c\u5bb9\u6027\u3002<\/p>\n<hr \/>\n<h4>3.2 WORKDIR&#xff1a;\u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<\/h4>\n<p>\u76f8\u5f53\u4e8e\u5728\u5bb9\u5668\u91cc cd \u5230\u67d0\u4e2a\u76ee\u5f55&#xff0c;\u540e\u7eed\u6240\u6709\u6307\u4ee4\u90fd\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u6267\u884c&#xff1a;<\/p>\n<p># \u521b\u5efa\u5e76\u8fdb\u5165 \/app \u76ee\u5f55&#xff08;\u76ee\u5f55\u4e0d\u5b58\u5728\u4f1a\u81ea\u52a8\u521b\u5efa&#xff09;<br \/>\nWORKDIR \/app<br \/>\n\u200b<br \/>\n# \u540e\u9762\u7684 COPY\u3001RUN \u90fd\u5728 \/app \u4e0b\u64cd\u4f5c<br \/>\nCOPY . .<br \/>\nRUN pip install -r requirements.txt<\/p>\n<p>\u597d\u4e60\u60ef&#xff1a;\u6c38\u8fdc\u4e0d\u8981\u7701\u7565 WORKDIR\u3002 \u4e0d\u8bbe\u7684\u8bdd&#xff0c;\u9ed8\u8ba4\u5728 \/ \u6839\u76ee\u5f55\u64cd\u4f5c&#xff0c;\u6587\u4ef6\u6563\u843d\u5728\u6839\u76ee\u5f55\u65e2\u4e71\u53c8\u4e0d\u5b89\u5168\u3002<\/p>\n<hr \/>\n<h4>3.3 COPY vs ADD&#xff1a;\u590d\u5236\u6587\u4ef6\u8fdb\u955c\u50cf<\/h4>\n<p>\u8fd9\u4e24\u4e2a\u90fd\u80fd\u628a\u5bbf\u4e3b\u673a\u6587\u4ef6\u590d\u5236\u5230\u955c\u50cf\u91cc&#xff0c;\u4f46\u6709\u533a\u522b&#xff1a;<\/p>\n<p># COPY&#xff1a;\u7b80\u5355\u7c97\u66b4&#xff0c;\u53ea\u5e72\u590d\u5236\u8fd9\u4e00\u4ef6\u4e8b<br \/>\nCOPY requirements.txt \/app\/<br \/>\nCOPY . \/app\/<br \/>\n\u200b<br \/>\n# ADD&#xff1a;\u591a\u4e86\u4e24\u4e2a&#034;\u8d85\u80fd\u529b&#034;<br \/>\nADD archive.tar.gz \/app\/ \u00a0 \u00a0 # \u81ea\u52a8\u89e3\u538b tar \u5305<br \/>\nADD https:\/\/example.com\/file.zip \/tmp\/ \u00a0# \u53ef\u4ee5\u4ece URL \u4e0b\u8f7d<\/p>\n<p>\u5bf9\u6bd4\u8868&#xff1a;<\/p>\n<table>\n<tr>\u7279\u6027COPYADD<\/tr>\n<tbody>\n<tr>\n<td>\u590d\u5236\u672c\u5730\u6587\u4ef6<\/td>\n<td>\u2705<\/td>\n<td>\u2705<\/td>\n<\/tr>\n<tr>\n<td>\u81ea\u52a8\u89e3\u538b tar<\/td>\n<td>\u274c<\/td>\n<td>\u2705<\/td>\n<\/tr>\n<tr>\n<td>\u652f\u6301 URL \u4e0b\u8f7d<\/td>\n<td>\u274c<\/td>\n<td>\u2705<\/td>\n<\/tr>\n<tr>\n<td>\u63a8\u8350\u4f7f\u7528<\/td>\n<td>\u63a8\u8350<\/td>\n<td>\u53ea\u5728\u9700\u8981\u89e3\u538b\u65f6\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6700\u4f73\u5b9e\u8df5&#xff1a;99% \u7684\u573a\u666f\u7528 COPY \u5c31\u591f\u4e86\u3002 ADD \u7684&#034;\u8d85\u80fd\u529b&#034;\u5bb9\u6613\u5f15\u53d1\u610f\u5916\u884c\u4e3a&#xff08;\u6bd4\u5982\u4f60\u4ee5\u4e3a\u53ea\u662f\u590d\u5236&#xff0c;\u7ed3\u679c\u5b83\u7ed9\u4f60\u89e3\u538b\u4e86&#xff09;&#xff0c;\u6240\u4ee5 Docker \u5b98\u65b9\u4e5f\u5efa\u8bae\u4f18\u5148\u7528 COPY\u3002<\/p>\n<hr \/>\n<h4>3.4 RUN&#xff1a;\u6267\u884c\u547d\u4ee4<\/h4>\n<p>RUN \u7528\u6765\u5728\u6784\u5efa\u955c\u50cf\u65f6\u6267\u884c\u547d\u4ee4&#xff0c;\u6700\u5e38\u89c1\u7684\u7528\u9014\u662f\u5b89\u88c5\u4f9d\u8d56&#xff1a;<\/p>\n<p># Ubuntu\/Debian \u7cfb\u88c5\u8f6f\u4ef6<br \/>\nRUN apt update &amp;&amp; apt install -y curl git<br \/>\n\u200b<br \/>\n# Python \u88c5\u4f9d\u8d56<br \/>\nRUN pip install flask requests<br \/>\n\u200b<br \/>\n# Node.js \u88c5\u4f9d\u8d56<br \/>\nRUN npm install<\/p>\n<p>\u26a0\ufe0f \u5c42\u7f13\u5b58\u9677\u9631&#xff08;\u65b0\u624b\u5fc5\u77e5&#xff09;<\/p>\n<p>\u6bcf\u4e00\u6761 RUN \u90fd\u4f1a\u5728\u955c\u50cf\u91cc\u521b\u5efa\u4e00\u4e2a\u65b0\u5c42\u3002\u53cd\u6a21\u5f0f&#xff1a;<\/p>\n<p># \u274c \u9519\u8bef\u793a\u8303&#xff1a;\u4e09\u6761 RUN \u4ea7\u751f\u4e09\u4e2a\u5c42&#xff0c;\u800c\u4e14 apt \u7f13\u5b58\u5360\u7a7a\u95f4<br \/>\nRUN apt update<br \/>\nRUN apt install -y curl<br \/>\nRUN apt install -y git<\/p>\n<p>\u6b63\u786e\u505a\u6cd5&#xff1a;\u5408\u5e76\u547d\u4ee4 &#043; \u6e05\u7406\u7f13\u5b58<\/p>\n<p># \u2705 \u6b63\u786e\u793a\u8303&#xff1a;\u4e00\u6761 RUN&#xff0c;\u6e05\u7406\u7f13\u5b58\u51cf\u5c0f\u4f53\u79ef<br \/>\nRUN apt update \\\\<br \/>\n \u00a0  &amp;&amp; apt install -y &#8211;no-install-recommends curl git \\\\<br \/>\n \u00a0  &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*<\/p>\n<hr \/>\n<h4>3.5 ENV&#xff1a;\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h4>\n<p># \u683c\u5f0f 1&#xff1a;\u5355\u4e2a\u53d8\u91cf<br \/>\nENV APP_ENV&#061;production<br \/>\n\u200b<br \/>\n# \u683c\u5f0f 2&#xff1a;\u591a\u4e2a\u53d8\u91cf<br \/>\nENV APP_PORT&#061;8080 APP_HOST&#061;0.0.0.0<br \/>\n\u200b<br \/>\n# \u5728\u540e\u7eed\u6307\u4ee4\u548c\u5bb9\u5668\u8fd0\u884c\u65f6\u90fd\u80fd\u7528\u5230<br \/>\nRUN echo &#034;\u5f53\u524d\u73af\u5883&#xff1a;$APP_ENV&#034;<br \/>\nCMD python app.py &#8211;port $APP_PORT<\/p>\n<hr \/>\n<h4>3.6 EXPOSE&#xff1a;\u58f0\u660e\u7aef\u53e3&#xff08;\u4f46\u522b\u5f53\u771f&#xff09;<\/h4>\n<p># \u58f0\u660e\u5e94\u7528\u76d1\u542c\u7684\u7aef\u53e3<br \/>\nEXPOSE 8080<br \/>\nEXPOSE 5000<\/p>\n<p>\u6ce8\u610f&#xff1a;EXPOSE \u53ea\u662f\u4e2a&#034;\u6587\u6863\u8bf4\u660e&#034;&#xff0c;\u4e0d\u4f1a\u771f\u7684\u6620\u5c04\u7aef\u53e3&#xff01;<\/p>\n<p>\u8981\u8ba9\u5916\u90e8\u8bbf\u95ee&#xff0c;\u5fc5\u987b\u5728 docker run \u65f6\u7528 -p \u53c2\u6570&#xff1a;<\/p>\n<p># EXPOSE 8080 \u53ea\u662f\u544a\u8bc9\u4f60&#034;\u8fd9\u4e2a\u5e94\u7528\u7528 8080 \u7aef\u53e3&#034;<br \/>\n# \u771f\u6b63\u6620\u5c04\u7aef\u53e3\u8fd8\u5f97\u9760 -p<br \/>\ndocker run -p 8080:8080 myapp<\/p>\n<p>\u628a\u5b83\u60f3\u8c61\u6210\u5728\u5305\u88c5\u76d2\u4e0a\u8d34\u6807\u7b7e&#xff1a;&#034;\u672c\u4ea7\u54c1\u4f7f\u7528 8080 \u7aef\u53e3&#034;\u2014\u2014\u8d34\u4e0d\u8d34\u6807\u7b7e&#xff0c;\u4ea7\u54c1\u672c\u8eab\u90fd\u4e00\u6837\u5de5\u4f5c\u3002<\/p>\n<hr \/>\n<h4>3.7 CMD vs ENTRYPOINT&#xff1a;\u6700\u5bb9\u6613\u641e\u6df7\u7684\u4e24\u4e2a\u6307\u4ee4<\/h4>\n<p>\u8fd9\u662f Dockerfile \u91cc\u6700\u5bb9\u6613\u8e29\u5751\u7684\u5730\u65b9&#xff0c;\u52a1\u5fc5\u4ed4\u7ec6\u770b\u6e05\u695a\u3002<\/p>\n<h5>\u6838\u5fc3\u533a\u522b<\/h5>\n<table>\n<tr>\u7279\u6027CMDENTRYPOINT<\/tr>\n<tbody>\n<tr>\n<td>\u4f5c\u7528<\/td>\n<td>\u5bb9\u5668\u542f\u52a8\u65f6\u7684\u9ed8\u8ba4\u547d\u4ee4<\/td>\n<td>\u5bb9\u5668\u542f\u52a8\u65f6\u7684\u4e3b\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>\u88ab\u8986\u76d6<\/td>\n<td>docker run \u540e\u52a0\u53c2\u6570\u4f1a\u88ab\u8986\u76d6<\/td>\n<td>\u4e0d\u4f1a\u88ab\u8986\u76d6&#xff08;\u53c2\u6570\u4f1a\u8ffd\u52a0&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u53ef\u7075\u6d3b\u66ff\u6362\u7684\u9ed8\u8ba4\u884c\u4e3a<\/td>\n<td>\u56fa\u5b9a\u7684\u4e3b\u7a0b\u5e8f\u5165\u53e3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\u4ee3\u7801\u5bf9\u6bd4<\/h5>\n<p># \u4f7f\u7528 CMD<br \/>\nFROM python:3.11-slim<br \/>\nWORKDIR \/app<br \/>\nCOPY . .<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<p>\u8fd0\u884c&#xff1a;<\/p>\n<p># \u6b63\u5e38\u542f\u52a8&#xff1a;\u6267\u884c python app.py<br \/>\ndocker run myapp<br \/>\n\u200b<br \/>\n# \u8986\u76d6 CMD&#xff1a;\u6267\u884c bash&#xff08;\u8fdb\u5165\u4e86 shell&#xff0c;\u4e0d\u542f\u52a8\u5e94\u7528\u4e86&#xff09;<br \/>\ndocker run -it myapp bash<\/p>\n<p># \u4f7f\u7528 ENTRYPOINT<br \/>\nFROM python:3.11-slim<br \/>\nWORKDIR \/app<br \/>\nCOPY . .<br \/>\nENTRYPOINT [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<p>\u8fd0\u884c&#xff1a;<\/p>\n<p># \u6b63\u5e38\u542f\u52a8&#xff1a;\u6267\u884c python app.py<br \/>\ndocker run myapp<br \/>\n\u200b<br \/>\n# \u8ffd\u52a0\u53c2\u6570&#xff1a;\u6267\u884c python app.py &#8211;debug<br \/>\ndocker run myapp &#8211;debug<br \/>\n\u200b<br \/>\n# \u60f3\u8986\u76d6 ENTRYPOINT&#xff1a;\u5fc5\u987b\u663e\u5f0f\u6307\u5b9a &#8211;entrypoint<br \/>\ndocker run &#8211;entrypoint bash -it myapp<\/p>\n<h5>\u9ec4\u91d1\u7ec4\u5408<\/h5>\n<p>\u6700\u4f73\u5b9e\u8df5&#xff1a;ENTRYPOINT &#043; CMD \u642d\u914d\u4f7f\u7528<\/p>\n<p># ENTRYPOINT \u662f&#034;\u4e3b\u83dc&#034;&#xff08;\u56fa\u5b9a\u7684&#xff09;<br \/>\n# CMD \u662f&#034;\u914d\u83dc&#034;&#xff08;\u53ef\u66ff\u6362\u7684\u9ed8\u8ba4\u53c2\u6570&#xff09;<br \/>\nENTRYPOINT [&#034;python&#034;]<br \/>\nCMD [&#034;app.py&#034;]<\/p>\n<p>\u8fd9\u6837&#xff1a;<\/p>\n<ul>\n<li>\n<p>docker run myapp \u2192 \u6267\u884c python app.py<\/p>\n<\/li>\n<li>\n<p>docker run myapp script.py \u2192 \u6267\u884c python script.py&#xff08;\u8986\u76d6\u4e86\u9ed8\u8ba4\u53c2\u6570&#xff09;<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h4>3.8 .dockerignore&#xff1a;\u6392\u9664\u4e0d\u9700\u8981\u7684\u6587\u4ef6<\/h4>\n<p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u521b\u5efa\u4e00\u4e2a .dockerignore \u6587\u4ef6&#xff0c;\u7c7b\u4f3c .gitignore&#xff1a;<\/p>\n<p># Python \u9879\u76ee<br \/>\n__pycache__\/<br \/>\n*.pyc<br \/>\n*.pyo<br \/>\n.git\/<br \/>\n.gitignore<br \/>\nvenv\/<br \/>\n.venv\/<br \/>\n*.md<br \/>\n.env<br \/>\n.pytest_cache\/<br \/>\n\u200b<br \/>\n# Node.js \u9879\u76ee<br \/>\nnode_modules\/<br \/>\nnpm-debug.log*<br \/>\n.DS_Store<\/p>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f;<\/p>\n<p>\u5982\u679c\u4f60 COPY . . \u628a\u6574\u4e2a\u9879\u76ee\u62f7\u8fdb\u955c\u50cf&#xff0c;\u4f1a\u628a\u8fd9\u4e9b\u5783\u573e\u4e5f\u62f7\u8fdb\u53bb&#xff1a;<\/p>\n<ul>\n<li>\n<p>node_modules\/&#xff1a;\u51e0\u767e MB \u7684\u4f9d\u8d56&#xff0c;\u5bb9\u5668\u91cc\u4f1a\u91cd\u88c5<\/p>\n<\/li>\n<li>\n<p>.git\/&#xff1a;\u6574\u4e2a Git \u5386\u53f2&#xff0c;\u767d\u767d\u5360\u7a7a\u95f4<\/p>\n<\/li>\n<li>\n<p>venv\/&#xff1a;\u672c\u5730\u865a\u62df\u73af\u5883&#xff0c;\u5bb9\u5668\u91cc\u7528\u4e0d\u5230<\/p>\n<\/li>\n<\/ul>\n<p>\u4e0d\u52a0 .dockerignore&#xff0c;\u955c\u50cf\u4f53\u79ef\u53ef\u80fd\u81a8\u80c0\u597d\u51e0\u500d&#xff0c;\u6784\u5efa\u901f\u5ea6\u4e5f\u4f1a\u53d8\u6162\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u5b9e\u6218 1&#xff1a;Python Flask \u5e94\u7528\u5b8c\u6574\u6253\u5305<\/h3>\n<p>\u6765\u4e00\u4e2a\u771f\u5b9e\u573a\u666f&#xff1a;\u628a\u4e00\u4e2a Flask Web \u5e94\u7528\u6253\u5305\u6210 Docker \u955c\u50cf\u3002<\/p>\n<h4>4.1 \u9879\u76ee\u7ed3\u6784<\/h4>\n<p>my-flask-app\/<br \/>\n\u251c\u2500\u2500 app.py \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  # Flask \u5e94\u7528\u4e3b\u7a0b\u5e8f<br \/>\n\u251c\u2500\u2500 requirements.txt \u00a0  # Python \u4f9d\u8d56<br \/>\n\u251c\u2500\u2500 Dockerfile \u00a0 \u00a0 \u00a0 \u00a0  # Docker \u83dc\u8c31<br \/>\n\u2514\u2500\u2500 .dockerignore \u00a0 \u00a0 \u00a0 # \u6392\u9664\u6587\u4ef6<\/p>\n<h4>4.2 \u7f16\u5199 Flask \u5e94\u7528<\/h4>\n<p># app.py<br \/>\nfrom flask import Flask, jsonify<br \/>\nimport socket<br \/>\n\u200b<br \/>\napp &#061; Flask(__name__)<br \/>\n\u200b<br \/>\n&#064;app.route(&#039;\/&#039;)<br \/>\ndef hello():<br \/>\n \u00a0 \u00a0return jsonify({<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0&#034;message&#034;: &#034;Hello from Docker!&#034;,<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0&#034;hostname&#034;: socket.gethostname(),<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0&#034;python_version&#034;: &#034;3.11&#034;<br \/>\n \u00a0  })<br \/>\n\u200b<br \/>\n&#064;app.route(&#039;\/health&#039;)<br \/>\ndef health():<br \/>\n \u00a0 \u00a0return jsonify({&#034;status&#034;: &#034;healthy&#034;})<br \/>\n\u200b<br \/>\nif __name__ &#061;&#061; &#039;__main__&#039;:<br \/>\n \u00a0 \u00a0# \u6ce8\u610f&#xff1a;host \u5fc5\u987b\u662f 0.0.0.0&#xff0c;\u5426\u5219\u5bb9\u5668\u5916\u8bbf\u95ee\u4e0d\u5230<br \/>\n \u00a0 \u00a0app.run(host&#061;&#039;0.0.0.0&#039;, port&#061;5000)<\/p>\n<p># requirements.txt<br \/>\nflask&#061;&#061;3.0.0<\/p>\n<h4>4.3 \u7f16\u5199 Dockerfile<\/h4>\n<p># 1. \u9009\u62e9\u57fa\u7840\u955c\u50cf<br \/>\nFROM python:3.11-slim<br \/>\n\u200b<br \/>\n# 2. \u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<br \/>\nWORKDIR \/app<br \/>\n\u200b<br \/>\n# 3. \u5148\u590d\u5236\u4f9d\u8d56\u6587\u4ef6&#xff08;\u5229\u7528\u5c42\u7f13\u5b58&#xff0c;\u540e\u9762\u4f1a\u8bb2&#xff09;<br \/>\nCOPY requirements.txt .<br \/>\n\u200b<br \/>\n# 4. \u5b89\u88c5\u4f9d\u8d56<br \/>\nRUN pip install &#8211;no-cache-dir -r requirements.txt<br \/>\n\u200b<br \/>\n# 5. \u518d\u590d\u5236\u5e94\u7528\u4ee3\u7801<br \/>\nCOPY . .<br \/>\n\u200b<br \/>\n# 6. \u58f0\u660e\u7aef\u53e3&#xff08;\u6587\u6863\u8bf4\u660e&#xff09;<br \/>\nEXPOSE 5000<br \/>\n\u200b<br \/>\n# 7. \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<br \/>\nENV FLASK_APP&#061;app.py<br \/>\n\u200b<br \/>\n# 8. \u542f\u52a8\u547d\u4ee4<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<h4>4.4 \u6784\u5efa\u955c\u50cf<\/h4>\n<p># \u5728\u9879\u76ee\u76ee\u5f55\u4e0b\u6267\u884c&#xff08;\u6ce8\u610f\u6700\u540e\u90a3\u4e2a\u70b9 .&#xff09;<br \/>\ndocker build -t my-flask-app:v1 .<\/p>\n<p>\u6784\u5efa\u8f93\u51fa&#xff1a;<\/p>\n<p>[&#043;] Building 15.3s (9\/9)<br \/>\n &#061;&gt; [1\/5] FROM docker.io\/library\/python:3.11-slim \u00a0 \u00a0 \u00a0 \u00a0  3.2s<br \/>\n &#061;&gt; [2\/5] WORKDIR \/app \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0.1s<br \/>\n &#061;&gt; [3\/5] COPY requirements.txt . \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  0.0s<br \/>\n &#061;&gt; [4\/5] RUN pip install &#8211;no-cache-dir -r requirements \u00a0 8.5s<br \/>\n &#061;&gt; [5\/5] COPY . . \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0.1s<br \/>\n &#061;&gt; exporting to image \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 3.4s<br \/>\n &#061;&gt; &#061;&gt; naming to docker.io\/library\/my-flask-app:v1<\/p>\n<h4>4.5 \u8fd0\u884c\u5bb9\u5668<\/h4>\n<p>docker run -d -p 5000:5000 &#8211;name flask-demo my-flask-app:v1<\/p>\n<p>\u6d4b\u8bd5\u8bbf\u95ee&#xff1a;<\/p>\n<p>curl http:\/\/localhost:5000\/<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>{<br \/>\n \u00a0&#034;hostname&#034;: &#034;a3f5b7c8d9e1&#034;,<br \/>\n \u00a0&#034;message&#034;: &#034;Hello from Docker!&#034;,<br \/>\n \u00a0&#034;python_version&#034;: &#034;3.11&#034;<br \/>\n}<\/p>\n<p>\u770b\u5230 hostname \u662f\u5bb9\u5668 ID \u800c\u4e0d\u662f\u4f60\u7684\u672c\u673a\u540d&#xff0c;\u8bf4\u660e\u5e94\u7528\u786e\u5b9e\u5728\u5bb9\u5668\u91cc\u8dd1\u8d77\u6765\u4e86&#xff01;<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u5b9e\u6218 2&#xff1a;Node.js Express \u5e94\u7528\u5b8c\u6574\u6253\u5305<\/h3>\n<h4>5.1 \u9879\u76ee\u7ed3\u6784<\/h4>\n<p>my-express-app\/<br \/>\n\u251c\u2500\u2500 index.js \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # Express \u5e94\u7528\u4e3b\u7a0b\u5e8f<br \/>\n\u251c\u2500\u2500 package.json \u00a0 \u00a0 \u00a0 # Node.js \u4f9d\u8d56\u58f0\u660e<br \/>\n\u251c\u2500\u2500 Dockerfile \u00a0 \u00a0 \u00a0 \u00a0 # Docker \u83dc\u8c31<br \/>\n\u2514\u2500\u2500 .dockerignore \u00a0 \u00a0  # \u6392\u9664\u6587\u4ef6<\/p>\n<h4>5.2 \u7f16\u5199 Express \u5e94\u7528<\/h4>\n<p>\/\/ index.js<br \/>\nconst express &#061; require(&#039;express&#039;);<br \/>\nconst os &#061; require(&#039;os&#039;);<br \/>\nconst app &#061; express();<br \/>\n\u200b<br \/>\napp.get(&#039;\/&#039;, (req, res) &#061;&gt; {<br \/>\n \u00a0res.json({<br \/>\n \u00a0 \u00a0message: &#039;Hello from Docker!&#039;,<br \/>\n \u00a0 \u00a0hostname: os.hostname(),<br \/>\n \u00a0 \u00a0platform: os.platform(),<br \/>\n \u00a0 \u00a0node_version: process.version<br \/>\n  });<br \/>\n});<br \/>\n\u200b<br \/>\napp.get(&#039;\/health&#039;, (req, res) &#061;&gt; {<br \/>\n \u00a0res.json({ status: &#039;healthy&#039;, uptime: process.uptime() });<br \/>\n});<br \/>\n\u200b<br \/>\nconst PORT &#061; process.env.PORT || 3000;<br \/>\napp.listen(PORT, &#039;0.0.0.0&#039;, () &#061;&gt; {<br \/>\n \u00a0console.log(&#096;Server running on port ${PORT}&#096;);<br \/>\n});<\/p>\n<p>\/\/ package.json<br \/>\n{<br \/>\n \u00a0&#034;name&#034;: &#034;my-express-app&#034;,<br \/>\n \u00a0&#034;version&#034;: &#034;1.0.0&#034;,<br \/>\n \u00a0&#034;main&#034;: &#034;index.js&#034;,<br \/>\n \u00a0&#034;scripts&#034;: {<br \/>\n \u00a0 \u00a0&#034;start&#034;: &#034;node index.js&#034;<br \/>\n  },<br \/>\n \u00a0&#034;dependencies&#034;: {<br \/>\n \u00a0 \u00a0&#034;express&#034;: &#034;^4.18.2&#034;<br \/>\n  }<br \/>\n}<\/p>\n<h4>5.3 \u7f16\u5199 Dockerfile<\/h4>\n<p># 1. \u9009\u62e9\u57fa\u7840\u955c\u50cf&#xff08;alpine \u7248\u672c\u6781\u5c0f&#xff0c;\u7ea6 180MB&#xff09;<br \/>\nFROM node:20-alpine<br \/>\n\u200b<br \/>\n# 2. \u8bbe\u7f6e\u5de5\u4f5c\u76ee\u5f55<br \/>\nWORKDIR \/app<br \/>\n\u200b<br \/>\n# 3. \u5148\u590d\u5236 package.json&#xff08;\u5229\u7528\u5c42\u7f13\u5b58&#xff09;<br \/>\nCOPY package*.json .\/<br \/>\n\u200b<br \/>\n# 4. \u5b89\u88c5\u751f\u4ea7\u4f9d\u8d56&#xff08;&#8211;production \u4e0d\u88c5 devDependencies&#xff09;<br \/>\nRUN npm install &#8211;production<br \/>\n\u200b<br \/>\n# 5. \u518d\u590d\u5236\u5e94\u7528\u4ee3\u7801<br \/>\nCOPY . .<br \/>\n\u200b<br \/>\n# 6. \u58f0\u660e\u7aef\u53e3<br \/>\nEXPOSE 3000<br \/>\n\u200b<br \/>\n# 7. \u542f\u52a8\u547d\u4ee4<br \/>\nCMD [&#034;node&#034;, &#034;index.js&#034;]<\/p>\n<h4>5.4 \u6784\u5efa\u548c\u8fd0\u884c<\/h4>\n<p># \u6784\u5efa<br \/>\ndocker build -t my-express-app:v1 .<br \/>\n\u200b<br \/>\n# \u8fd0\u884c<br \/>\ndocker run -d -p 3000:3000 &#8211;name express-demo my-express-app:v1<br \/>\n\u200b<br \/>\n# \u6d4b\u8bd5<br \/>\ncurl http:\/\/localhost:3000\/<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>{<br \/>\n \u00a0&#034;message&#034;: &#034;Hello from Docker!&#034;,<br \/>\n \u00a0&#034;hostname&#034;: &#034;b4e6c8d0f2a3&#034;,<br \/>\n \u00a0&#034;platform&#034;: &#034;linux&#034;,<br \/>\n \u00a0&#034;node_version&#034;: &#034;v20.11.0&#034;<br \/>\n}<\/p>\n<hr \/>\n<h3>\u516d\u3001\u6784\u5efa\u4e0a\u4e0b\u6587&#xff1a;\u90a3\u4e2a\u70b9 . \u5230\u5e95\u662f\u4ec0\u4e48\u610f\u601d&#xff1f;<\/h3>\n<p>docker build -t myapp:v1 .<br \/>\n# \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  \u2191<br \/>\n# \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  \u8fd9\u4e2a\u70b9\u662f\u5565&#xff1f;<\/p>\n<p>\u8fd9\u4e2a\u70b9\u53eb\u6784\u5efa\u4e0a\u4e0b\u6587&#xff08;Build Context&#xff09;&#xff0c;\u5b83\u544a\u8bc9 Docker&#xff1a;&#034;\u628a\u5f53\u524d\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u6587\u4ef6\u53d1\u9001\u7ed9 Docker \u5b88\u62a4\u8fdb\u7a0b&#xff0c;\u4f9b\u6784\u5efa\u4f7f\u7528\u3002&#034;<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u53d1\u9001\u6587\u4ef6&#xff1f;<\/p>\n<p>\u56e0\u4e3a Dockerfile \u91cc\u7684 COPY . . \u9700\u8981\u77e5\u9053&#034;\u4ece\u54ea\u91cc\u62f7&#034;\u2014\u2014\u7b54\u6848\u5c31\u662f\u6784\u5efa\u4e0a\u4e0b\u6587\u3002<\/p>\n<p>\u5e38\u89c1\u9519\u8bef&#xff1a;<\/p>\n<p># \u274c \u9519\u8bef&#xff1a;\u4e0a\u4e0b\u6587\u662f \/home\/user&#xff0c;\u4f46 Dockerfile \u5728\u5b50\u76ee\u5f55\u91cc<br \/>\ncd \/home\/user<br \/>\ndocker build -t myapp myproject\/Dockerfile<br \/>\n# \u62a5\u9519&#xff1a;unable to prepare context<br \/>\n\u200b<br \/>\n# \u2705 \u6b63\u786e&#xff1a;\u4e0a\u4e0b\u6587\u662f\u5305\u542b Dockerfile \u7684\u76ee\u5f55<br \/>\ncd \/home\/user\/myproject<br \/>\ndocker build -t myapp .<\/p>\n<p>\u4e5f\u53ef\u4ee5\u6307\u5b9a\u5176\u4ed6\u8def\u5f84&#xff1a;<\/p>\n<p># \u4e0a\u4e0b\u6587\u662f \/path\/to\/project&#xff0c;Dockerfile \u4e5f\u5728\u90a3<br \/>\ndocker build -t myapp \/path\/to\/project<br \/>\n\u200b<br \/>\n# \u4e0a\u4e0b\u6587\u662f\u5f53\u524d\u76ee\u5f55&#xff0c;Dockerfile \u7528\u522b\u7684\u540d\u5b57<br \/>\ndocker build -t myapp -f Dockerfile.prod .<\/p>\n<p>\u8bb0\u4f4f&#xff1a;\u6784\u5efa\u4e0a\u4e0b\u6587\u51b3\u5b9a\u4e86\u54ea\u4e9b\u6587\u4ef6\u80fd\u88ab COPY \u8fdb\u955c\u50cf&#xff0c;\u4e5f\u51b3\u5b9a\u4e86 .dockerignore \u8981\u653e\u5728\u54ea\u91cc\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001\u955c\u50cf\u5c42\u7f13\u5b58\u4f18\u5316&#xff1a;\u987a\u5e8f\u771f\u7684\u5f88\u91cd\u8981<\/h3>\n<p>Docker \u6784\u5efa\u955c\u50cf\u65f6&#xff0c;\u6bcf\u4e00\u884c\u6307\u4ee4\u90fd\u4f1a\u751f\u6210\u4e00\u5c42\u3002\u5982\u679c\u67d0\u4e00\u5c42\u7684\u5185\u5bb9\u6ca1\u53d8&#xff0c;Docker \u4f1a\u76f4\u63a5\u7528\u7f13\u5b58&#xff0c;\u4e0d\u518d\u91cd\u65b0\u6267\u884c\u3002<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1152\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827101635-6a900e835ebab.jpg\" width=\"2048\" \/><\/p>\n<p>\u25b2 \u5c42\u7f13\u5b58\u7684\u7cbe\u9ad3&#xff1a;\u628a\u4f9d\u8d56\u6e05\u5355\u653e\u524d\u9762\u3001\u5e94\u7528\u4ee3\u7801\u653e\u540e\u9762&#xff0c;\u53ea\u6709\u6539\u4f9d\u8d56\u624d\u4f1a\u89e6\u53d1&#034;\u91cd\u88c5\u4f9d\u8d56&#034;\u3002<\/p>\n<h4>7.1 \u9519\u8bef\u987a\u5e8f&#xff1a;\u6bcf\u6b21\u90fd\u91cd\u88c5\u4f9d\u8d56<\/h4>\n<p># \u274c \u6bcf\u6b21\u6539\u4ee3\u7801\u90fd\u8981\u91cd\u88c5\u4f9d\u8d56&#xff08;\u8d85\u6162&#xff09;<br \/>\nFROM python:3.11-slim<br \/>\nWORKDIR \/app<br \/>\nCOPY . . \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u62f7\u5165\u5168\u90e8\u4ee3\u7801&#xff08;\u5305\u62ec app.py&#xff09;<br \/>\nRUN pip install -r requirements.txt \u00a0# \u53ea\u8981\u4ee3\u7801\u53d8\u4e86&#xff0c;\u8fd9\u4e00\u5c42\u5c31\u91cd\u8dd1<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<p>\u95ee\u9898&#xff1a;\u4f60\u6539\u4e86 app.py \u4e00\u884c\u4ee3\u7801 \u2192 COPY . . \u8fd9\u4e00\u5c42\u5931\u6548 \u2192 \u540e\u9762\u7684 RUN pip install \u4e5f\u8ddf\u7740\u5931\u6548 \u2192 \u6bcf\u6b21\u6784\u5efa\u90fd\u91cd\u88c5\u4f9d\u8d56&#xff0c;\u6162\u5f97\u8981\u6b7b\u3002<\/p>\n<h4>7.2 \u6b63\u786e\u987a\u5e8f&#xff1a;\u5148\u62f7\u4f9d\u8d56\u6587\u4ef6&#xff0c;\u518d\u62f7\u4ee3\u7801<\/h4>\n<p># \u2705 \u6539\u4ee3\u7801\u4e0d\u4f1a\u91cd\u88c5\u4f9d\u8d56&#xff08;\u8d85\u5feb&#xff09;<br \/>\nFROM python:3.11-slim<br \/>\nWORKDIR \/app<br \/>\nCOPY requirements.txt . \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u53ea\u62f7\u5165\u4f9d\u8d56\u6587\u4ef6<br \/>\nRUN pip install -r requirements.txt \u00a0# \u4f9d\u8d56\u6ca1\u53d8\u5c31\u7528\u7f13\u5b58<br \/>\nCOPY . . \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # \u518d\u62f7\u5165\u5e94\u7528\u4ee3\u7801&#xff08;\u6539\u4ee3\u7801\u53ea\u5f71\u54cd\u8fd9\u4e00\u5c42&#xff09;<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<p>\u5bf9\u6bd4\u6548\u679c&#xff1a;<\/p>\n<table>\n<tr>\u64cd\u4f5c\u9519\u8bef\u987a\u5e8f\u8017\u65f6\u6b63\u786e\u987a\u5e8f\u8017\u65f6<\/tr>\n<tbody>\n<tr>\n<td>\u9996\u6b21\u6784\u5efa<\/td>\n<td>~30s<\/td>\n<td>~30s<\/td>\n<\/tr>\n<tr>\n<td>\u53ea\u6539\u4e86 app.py<\/td>\n<td>~30s&#xff08;\u91cd\u88c5\u4f9d\u8d56&#xff09;<\/td>\n<td>~2s&#xff08;\u7528\u7f13\u5b58&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6539\u4e86 requirements.txt<\/td>\n<td>~30s<\/td>\n<td>~30s&#xff08;\u5fc5\u987b\u91cd\u88c5&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u53e5\u8bdd\u603b\u7ed3&#xff1a;\u628a\u4e0d\u5e38\u53d8\u7684\u6587\u4ef6&#xff08;\u4f9d\u8d56\u6e05\u5355&#xff09;\u653e\u524d\u9762&#xff0c;\u5e38\u53d8\u7684\u6587\u4ef6&#xff08;\u5e94\u7528\u4ee3\u7801&#xff09;\u653e\u540e\u9762\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u672c\u6587\u8981\u70b9\u56de\u987e<\/h3>\n<li>\n<p>Dockerfile \u662f\u4e00\u4efd&#034;\u83dc\u8c31&#034;&#xff0c;\u544a\u8bc9 Docker \u600e\u4e48\u4e00\u6b65\u6b65\u6784\u5efa\u955c\u50cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>FROM \u5fc5\u987b\u7b2c\u4e00\u884c&#xff0c;\u9009\u62e9\u5408\u9002\u7684\u57fa\u7840\u955c\u50cf&#xff08;\u63a8\u8350 -slim \u7248\u672c&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>COPY vs ADD&#xff1a;99% \u573a\u666f\u7528 COPY&#xff0c;ADD \u53ea\u5728\u9700\u8981\u81ea\u52a8\u89e3\u538b\u65f6\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>CMD vs ENTRYPOINT&#xff1a;CMD \u53ef\u88ab\u8986\u76d6&#xff0c;ENTRYPOINT \u56fa\u5b9a\u6267\u884c&#xff0c;\u63a8\u8350\u4e24\u8005\u642d\u914d\u4f7f\u7528&#xff1b;<\/p>\n<\/li>\n<li>\n<p>EXPOSE \u53ea\u662f\u6587\u6863\u8bf4\u660e&#xff0c;\u771f\u6b63\u6620\u5c04\u7aef\u53e3\u9760 docker run -p&#xff1b;<\/p>\n<\/li>\n<li>\n<p>.dockerignore \u5fc5\u987b\u5199&#xff0c;\u6392\u9664 node_modules\u3001.git\u3001venv \u7b49\u5927\u6587\u4ef6&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u6784\u5efa\u4e0a\u4e0b\u6587&#xff1a;docker build \u6700\u540e\u90a3\u4e2a . \u51b3\u5b9a\u4e86\u54ea\u4e9b\u6587\u4ef6\u80fd\u88ab\u62f7\u8fdb\u955c\u50cf&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5c42\u7f13\u5b58\u4f18\u5316&#xff1a;\u5148 COPY requirements.txt \u518d COPY . .&#xff0c;\u6539\u4ee3\u7801\u4e0d\u91cd\u88c5\u4f9d\u8d56\u3002<\/p>\n<\/li>\n<hr \/>\n<h3>\u4e0b\u96c6\u9884\u544a<\/h3>\n<p>\u955c\u50cf\u6253\u5305\u597d\u4e86&#xff0c;\u4f46\u751f\u4ea7\u73af\u5883\u4e0d\u4f1a\u53ea\u7528\u4e00\u4e2a\u5bb9\u5668\u3002\u4e0b\u4e00\u7ae0\u6211\u4eec\u5b66\u4e60 Docker \u7f51\u7edc\u2014\u2014\u591a\u4e2a\u5bb9\u5668\u4e4b\u95f4\u600e\u4e48\u4e92\u76f8\u901a\u4fe1&#xff1f;\u600e\u4e48\u8ba9 Flask \u5bb9\u5668\u8bbf\u95ee MySQL \u5bb9\u5668&#xff1f;Bridge \u7f51\u7edc\u3001Host \u7f51\u7edc\u3001\u81ea\u5b9a\u4e49\u7f51\u7edc\u5404\u81ea\u600e\u4e48\u7528&#xff1f;\u656c\u8bf7\u671f\u5f85&#xff01;<\/p>\n<hr \/>\n<h3>\u9644&#xff1a;\u5b8c\u6574 Dockerfile \u6a21\u677f&#xff08;\u53ef\u76f4\u63a5\u590d\u5236\u4f7f\u7528&#xff09;<\/h3>\n<h4>Python \u5e94\u7528\u6a21\u677f<\/h4>\n<p>FROM python:3.11-slim<br \/>\n\u200b<br \/>\nWORKDIR \/app<br \/>\n\u200b<br \/>\n# \u5148\u62f7\u4f9d\u8d56<br \/>\nCOPY requirements.txt .<br \/>\nRUN pip install &#8211;no-cache-dir -r requirements.txt<br \/>\n\u200b<br \/>\n# \u518d\u62f7\u4ee3\u7801<br \/>\nCOPY . .<br \/>\n\u200b<br \/>\nEXPOSE 8000<br \/>\n\u200b<br \/>\nCMD [&#034;python&#034;, &#034;app.py&#034;]<\/p>\n<h4>Node.js \u5e94\u7528\u6a21\u677f<\/h4>\n<p>FROM node:20-alpine<br \/>\n\u200b<br \/>\nWORKDIR \/app<br \/>\n\u200b<br \/>\n# \u5148\u62f7\u4f9d\u8d56<br \/>\nCOPY package*.json .\/<br \/>\nRUN npm install &#8211;production<br \/>\n\u200b<br \/>\n# \u518d\u62f7\u4ee3\u7801<br \/>\nCOPY . .<br \/>\n\u200b<br \/>\nEXPOSE 3000<br \/>\n\u200b<br \/>\nCMD [&#034;node&#034;, &#034;index.js&#034;]<\/p>\n<h4>.dockerignore \u901a\u7528\u6a21\u677f<\/h4>\n<p># \u901a\u7528\u6392\u9664<br \/>\n.git\/<br \/>\n.gitignore<br \/>\n.vscode\/<br \/>\n.idea\/<br \/>\n*.md<br \/>\n.env<br \/>\n.env.*<br \/>\n\u200b<br \/>\n# Python \u4e13\u5c5e<br \/>\n__pycache__\/<br \/>\n*.pyc<br \/>\nvenv\/<br \/>\n.venv\/<br \/>\n.pytest_cache\/<br \/>\n\u200b<br \/>\n# Node.js \u4e13\u5c5e<br \/>\nnode_modules\/<br \/>\nnpm-debug.log*<br \/>\ndist\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>05. Dockerfile \u7f16\u5199\u5b9e\u6218&#xff1a;\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf\u524d\u9762\u51e0\u7bc7\u6587\u7ae0\u6211\u4eec\u90fd\u5728\u7528\u522b\u4eba\u505a\u597d\u7684\u955c\u50cf&#xff0c;docker pull nginx\u3001docker pull python\u2026\u2026\u4f46\u6bcf\u6b21\u90fd\u5f97\u624b\u52a8\u8fdb\u5bb9\u5668\u6539\u914d\u7f6e\u3001\u88c5\u4f9d\u8d56\u3001\u62f7\u4ee3\u7801&#xff0c;\u592a\u8d39\u52b2\u4e86\u3002\u80fd\u4e0d\u80fd\u628a\u6211\u5199\u597d\u7684\u5e94\u7528\u76f4\u63a5\u6253\u5305\u6210\u4e00\u4e2a\u955c\u50cf&#xff0c;\u4ee5\u540e docker run \u4e00\u628a\u68ad\u5c31\u8dd1\u8d77\u6765&#xff1f;\u4eca\u5929\u5c31\u6765\u641e\u5b9a\u8fd9\u4ef6\u4e8b\u2014\u2014\u5b66\u4f1a\u5199 Dockerfile&amp;#xff0c<\/p>\n","protected":false},"author":2,"featured_media":96475,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10187,53,27,50],"topic":[],"class_list":["post-96477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-codingplan","tag-ai","tag-docker","tag-50"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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:\/\/www.wsisp.com\/helps\/96477.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"05. Dockerfile \u7f16\u5199\u5b9e\u6218&#xff1a;\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf\u524d\u9762\u51e0\u7bc7\u6587\u7ae0\u6211\u4eec\u90fd\u5728\u7528\u522b\u4eba\u505a\u597d\u7684\u955c\u50cf&#xff0c;docker pull nginx\u3001docker pull python\u2026\u2026\u4f46\u6bcf\u6b21\u90fd\u5f97\u624b\u52a8\u8fdb\u5bb9\u5668\u6539\u914d\u7f6e\u3001\u88c5\u4f9d\u8d56\u3001\u62f7\u4ee3\u7801&#xff0c;\u592a\u8d39\u52b2\u4e86\u3002\u80fd\u4e0d\u80fd\u628a\u6211\u5199\u597d\u7684\u5e94\u7528\u76f4\u63a5\u6253\u5305\u6210\u4e00\u4e2a\u955c\u50cf&#xff0c;\u4ee5\u540e docker run \u4e00\u628a\u68ad\u5c31\u8dd1\u8d77\u6765&#xff1f;\u4eca\u5929\u5c31\u6765\u641e\u5b9a\u8fd9\u4ef6\u4e8b\u2014\u2014\u5b66\u4f1a\u5199 Dockerfile&amp;#xff0c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/96477.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-27T10:16:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827101634-6a900e82a19c7.jpg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/96477.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/96477.html\",\"name\":\"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-27T10:16:36+00:00\",\"dateModified\":\"2026-08-27T10:16:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/96477.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/96477.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/96477.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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:\/\/www.wsisp.com\/helps\/96477.html","og_locale":"zh_CN","og_type":"article","og_title":"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"05. Dockerfile \u7f16\u5199\u5b9e\u6218&#xff1a;\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf\u524d\u9762\u51e0\u7bc7\u6587\u7ae0\u6211\u4eec\u90fd\u5728\u7528\u522b\u4eba\u505a\u597d\u7684\u955c\u50cf&#xff0c;docker pull nginx\u3001docker pull python\u2026\u2026\u4f46\u6bcf\u6b21\u90fd\u5f97\u624b\u52a8\u8fdb\u5bb9\u5668\u6539\u914d\u7f6e\u3001\u88c5\u4f9d\u8d56\u3001\u62f7\u4ee3\u7801&#xff0c;\u592a\u8d39\u52b2\u4e86\u3002\u80fd\u4e0d\u80fd\u628a\u6211\u5199\u597d\u7684\u5e94\u7528\u76f4\u63a5\u6253\u5305\u6210\u4e00\u4e2a\u955c\u50cf&#xff0c;\u4ee5\u540e docker run \u4e00\u628a\u68ad\u5c31\u8dd1\u8d77\u6765&#xff1f;\u4eca\u5929\u5c31\u6765\u641e\u5b9a\u8fd9\u4ef6\u4e8b\u2014\u2014\u5b66\u4f1a\u5199 Dockerfile&amp;#xff0c","og_url":"https:\/\/www.wsisp.com\/helps\/96477.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-27T10:16:36+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260827101634-6a900e82a19c7.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/96477.html","url":"https:\/\/www.wsisp.com\/helps\/96477.html","name":"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-27T10:16:36+00:00","dateModified":"2026-08-27T10:16:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/96477.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/96477.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/96477.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"05. Dockerfile \u7f16\u5199\u5b9e\u6218\uff1a\u628a\u81ea\u5df1\u7684 Python\/Node.js \u5e94\u7528\u6253\u5305\u6210\u955c\u50cf"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/96477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=96477"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/96477\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/96475"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=96477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=96477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=96477"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=96477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}