{"id":34531,"date":"2025-04-29T18:25:42","date_gmt":"2025-04-29T10:25:42","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/34531.html"},"modified":"2025-04-29T18:25:42","modified_gmt":"2025-04-29T10:25:42","slug":"dockers%e5%ae%b9%e5%99%a8%e5%8c%96%e9%83%a8%e7%bd%b2%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/34531.html","title":{"rendered":"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668"},"content":{"rendered":"<h2>\u5b89\u88c5\u914d\u7f6e<\/h2>\n<li>\u5378\u8f7d\u65e7\u7248\u672c\u7684 dockers \u5bb9\u5668\u3001\u914d\u7f6e\u3001\u7f13\u5b58\u3002&#xff08;\u7b2c\u4e00\u6b21\u5b89\u88c5\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u8fd0\u884c\u6307\u4ee4&#xff09;<\/li>\n<p>for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done<\/p>\n<li>\u5728 linux \u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7ec8\u7aef\u4e00\u952e\u90e8\u7f72<\/li>\n<p>curl -sSL https:\/\/get.docker.com\/ | sh<\/p>\n<li>\u67e5\u770b\u662f\u5426\u5b89\u88c5\u6210\u529f<\/li>\n<p>docker -v<\/p>\n<p>docker compose version<\/p>\n<p>systemctl enable docker    # \u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u542f\u52a8<\/p>\n<li>\u5b89\u88c5\u6210\u529f\u540e\u7684 docker \u4e00\u822c\u4f4d\u4e8e \/var\/lib\/docker \u8def\u5f84&#xff0c;\u81ea\u884c\u6253\u5f00\u6539\u8def\u5f84&#xff0c;\u67e5\u770b\u5176\u6587\u4ef6\u5939\u7684\u4f5c\u7528\u3002<\/li>\n<p>\u5728\/var\/lib\/docker\u76ee\u5f55\u4e0b\u51fa\u73b0\u7684\u6587\u4ef6\u5939\u53ca\u5176\u4f5c\u7528\u5982\u4e0b:<\/p>\n<p>1. **buildkit**: Docker \u4f7f\u7528\u7684\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406\u5bb9\u5668\u955c\u50cf\u7684\u6784\u5efa\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u4e86\u66f4\u5feb\u901f\u548c\u9ad8\u6548\u7684\u955c\u50cf\u6784\u5efa\u529f\u80fd\u3002<\/p>\n<p>2. **containers**: \u5b58\u653e\u6b63\u5728\u8fd0\u884c\u6216\u5df2\u7ecf\u505c\u6b62\u7684\u5bb9\u5668\u7684\u76f8\u5173\u6570\u636e\u548c\u5143\u6570\u636e\u3002<\/p>\n<p>3. **image**: \u5b58\u653e\u5df2\u4e0b\u8f7d\u6216\u6784\u5efa\u7684Docker\u955c\u50cf\u6587\u4ef6\u3002<\/p>\n<p>4. **network**: \u5b58\u653eDocker\u7f51\u7edc\u7684\u76f8\u5173\u914d\u7f6e\u4fe1\u606f\u3002<\/p>\n<p>5. **overlay2**: Docker\u4f7f\u7528\u7684\u5b58\u50a8\u9a71\u52a8\u4e4b\u4e00,\u7528\u4e8e\u7ba1\u7406\u5bb9\u5668\u7684\u5206\u5c42\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n<p>6. **plugins**: \u5b58\u653eDocker\u63d2\u4ef6\u7684\u76f8\u5173\u6587\u4ef6\u3002<\/p>\n<p>7. **runtimes**: \u5b58\u653eDocker\u4f7f\u7528\u7684\u5bb9\u5668\u8fd0\u884c\u65f6\u76f8\u5173\u7684\u6587\u4ef6\u3002<\/p>\n<p>8. **swarm**: \u5982\u679c\u60a8\u4f7f\u7528\u4e86Docker Swarm\u6a21\u5f0f,\u8fd9\u4e2a\u76ee\u5f55\u5b58\u653eSwarm\u96c6\u7fa4\u7684\u76f8\u5173\u6570\u636e\u3002<\/p>\n<p>9. **tmp**: \u5b58\u653eDocker\u5f15\u64ce\u4f7f\u7528\u7684\u4e34\u65f6\u6587\u4ef6\u3002<\/p>\n<p>10. **volumes**: \u5b58\u653eDocker\u6570\u636e\u5377\u7684\u76f8\u5173\u6570\u636e\u3002<\/p>\n<p>11. **engine-id**: \u5b58\u653eDocker\u5f15\u64ce\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002<\/p>\n<h2>\u90e8\u7f72<\/h2>\n<li>\n<p>\u5de5\u5177 &#xff1a;<\/p>\n<ul>\n<li>window&#xff08;\u5728\u771f\u673a\u4e0a\u7f16\u5199\u6211\u7684\u9879\u76ee&#xff09;<\/li>\n<li>wsl<\/li>\n<li>Linux (\u5728 wsl \u5c42\u4e0a\u5b89\u88c5\u4e14\u5df2\u7ecf\u5b89\u88c5\u914d\u7f6e\u4e86 docker)<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u64cd\u4f5c\u8fc7\u7a0b<\/p>\n<ul>\n<li>\n<p>\u5728\u6211\u7684\u9879\u76ee\u8ddf\u76ee\u5f55\u4e2d\u7f16\u5199 Dockerfile&#xff0c; Dockerfile \u4e2d\u5b9a\u4e49\u7684\u5185\u5bb9\u7528\u4e8e\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6240\u6709\u5fc5\u8981\u4f9d\u8d56\u548c\u914d\u7f6e\u7684 Docker \u955c\u50cf\u3002<\/p>\n<\/li>\n<li>\n<p>\u6253\u5f00\u7ec8\u7aef wsl&#xff0c;\u8f93\u5165 pwd \u6307\u4ee4\u67e5\u770b\u5f53\u524d\u7684\u8def\u5f84&#xff0c;wsl \u7ec8\u7aef\u4e0a\u8bbf\u95ee \/mnt \u76ee\u5f55\u6765\u5bfc\u822a\u5230 Windows \u7684 C \u76d8\u548c D \u76d8&#xff0c;\u81f3\u6b64\u53ef\u4ee5\u5bfc\u822a\u5230\u6211\u7684\u9879\u76ee\u6240\u5728\u8def\u5f84<\/p>\n<\/li>\n<li>\n<p>\u6784\u5efa\u955c\u50cf\u5e76\u4e14\u8fdb\u884c\u6253\u5305\u955c\u50cf\u4e3a tar \u6587\u4ef6<\/p>\n<\/li>\n<\/ul>\n<p> docker build -t your-image-name .                    #\u521b\u5efa\u955c\u50cf<\/p>\n<p>docker save -o your-image-name.tar your-image-name    #\u6253\u5305\u955c\u50cf\u4e3atar&#xff0c;\u5e76\u4e14\u4f4d\u4e8e\u9879\u76ee\u8ddf\u76ee\u5f55\u4e0b<\/p>\n<ul>\n<li>\u5c06\u6253\u5305\u540e\u7684 tar \u6587\u4ef6\u62d6\u81f3 Linux \u7684\u6587\u4ef6\u8d44\u6e90\u91cc&#xff0c;\u5e76\u4e14\u7ec8\u7aef\u5bfc\u822a\u5230\u5b58\u653e tar \u6587\u4ef6\u7684\u8def\u5f84&#xff08;\u8fd9\u91cc\u5efa\u8bae\u81ea\u5df1 mkdir \u4e00\u4e2a\u6587\u4ef6\u5939\u4e13\u95e8\u7528\u6765\u5b58\u653e\u6587\u4ef6&#xff09;<\/li>\n<\/ul>\n<p>  docker load -i your-image-name. Tar    #\u52a0\u8f7d\u955c\u50cf<\/p>\n<p> docker images             #\u67e5\u770b\u955c\u50cf\u662f\u5426\u5bfc\u5165\u6210\u529f<\/p>\n<ul>\n<li>\n<p>\u6784\u5efa docker-compose.yml, \u5728\u91cc\u9762\u914d\u7f6e\u6211\u7684\u5bb9\u5668\u7aef\u53e3\u6620\u5c04\u95ee\u9898\u3001\u5bb9\u5668\u7684\u6570\u636e\u5e93\u8fde\u63a5\u3001\u5bb9\u5668\u7684\u5377\u7b49\u914d\u7f6e<\/p>\n<\/li>\n<li>\n<p>\u5728\u6211\u7684.yml \u8def\u5f84\u4e0a&#xff0c;\u4e00\u952e\u90e8\u7f72\u914d\u7f6e\u6211\u7684\u5bb9\u5668\u3002<\/p>\n<\/li>\n<\/ul>\n<p>   docker compose up               #\u7528\u4e8e\u542f\u52a8\u548c\u8fd0\u884c\u5b9a\u4e49\u5728 &#096;docker-compose.yml&#096; \u4e2d\u7684\u6240\u6709\u670d\u52a1<br \/>\n docker compose down              #\u7528\u4e8e\u505c\u6b62\u548c\u5220\u9664\u8fd9\u4e9b\u670d\u52a1 &#xff0c;\u6e05\u7406\u8d44\u6e90\n <\/li>\n<li>\n<p>\u5e38\u7528\u811a\u672c\u6307\u4ee4<\/p>\n<ul>\n<li>\n<p>\u8fd0\u884c\u5bb9\u5668&#xff1a;\u4f7f\u7528\u547d\u4ee4 docker run -d -p host-port:container-port your-image-name \u542f\u52a8\u5bb9\u5668\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ba1\u7406\u5bb9\u5668&#xff1a;\u4f7f\u7528 docker ps \u67e5\u770b\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668\u3001docker stop \u505c\u6b62\u5bb9\u5668\u7b49\u3001docker images \u67e5\u770b\u955c\u50cf\u3001docker start containerIP<\/p>\n<\/li>\n<li>\n<p>\u8fdb\u5165\u5bb9\u5668\u5185\u90e8&#xff1a;\u4f7f\u7528 docker exec -it \u300a\u5bb9\u5668\u540d\u6216\u8005id(\u5168\u6216\u8005\u524d4\u4f4d&#xff09;)\u300b \/bash &#xff0c;\u8fdb\u5165\u5bb9\u5668\u5185\u90e8\u53ef\u67e5\u770b\u5bb9\u5668\u5185\u90e8\u7684\u914d\u7f6e&#xff1b;\u4f7f\u7528 exit \u79bb\u5f00\u5f53\u524d\u7684\u5bb9\u5668<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Dockers-compose \u4ecb\u7ecd<\/p>\n<ul>\n<li>\n<p>\u5185\u90e8\u7684\u5377\u7684\u8bbe\u7f6e\u76f8\u5f53\u4e8e\u7aef\u53e3\u4e4b\u95f4\u7684\u6620\u5c04\u5173\u7cfb&#xff0c;\u5c06\u5f53\u524d\u7684\u5bbf\u4e3b\u673a\u7684\u6587\u4ef6\u8def\u5f84\u4e0e\u5bb9\u5668\u5185\u90e8\u7684\u8def\u5f84\u8fdb\u884c\u6620\u5c04<\/p>\n<\/li>\n<li>\n<p>\u901a\u8fc7\u63d0\u524d\u8bbe\u7f6e\u4e00\u4e9b\u6307\u4ee4&#xff0c;\u76f4\u63a5\u90e8\u7f72\u5bb9\u5668<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<h2>\u5bb9\u5668\u63a8\u8350<\/h2>\n<p>! \u6bcf\u4e00\u4e2a\u5bb9\u5668\u91cc\u9762\u76f8\u5f53\u4e8e\u4e00\u4e2a\u64cd\u4f5c\u7cfb\u7edf&#xff0c;\u6545\u5bf9\u5e94\u7684\u6bcf\u4e00\u4e2a\u5bb9\u5668\u7684 local host \u662f\u76f8\u4e92\u9694\u79bb\u7684&#xff0c;\u56e0\u6b64\u5982\u679c\u5bb9\u5668\u4e4b\u95f4\u8981\u8fdb\u884c\u901a\u4fe1&#xff0c;\u5f97\u5b9e\u73b0\u8bbe\u7f6e\u5171\u540c\u7684\u7f51\u5173&#xff08;\u9ed8\u8ba4\u7684 bridge \u4e5f\u53ef\u4ee5&#xff0c;\u4f46\u662f\u6709\u4e00\u4e9b\u5c40\u9650&#xff0c;\u5982\u591a\u4e3b\u673a\u901a\u4fe1\u3001dns \u5bb9\u5668\u540d\u79f0\u89e3\u6790\u7b49&#xff09;&#xff0c;\u8fd9\u6837\u5bb9\u5668\u4e4b\u95f4\u624d\u53ef\u4ee5\u8fdb\u884c\u901a\u4fe1<\/p>\n<h3>Note<\/h3>\n<ul>\n<li>Minimalist Github<\/li>\n<\/ul>\n<ul>\n<li>\u5206\u4eab\u6211\u4f7f\u7528\u4e24\u5e74\u7684\u6781\u7b80 \u7f51\u9875\u8bb0\u4e8b\u672c &#8211; \u627f\u98de\u4e4b\u548e<\/li>\n<\/ul>\n<h4>Install<\/h4>\n<li>Make a dir to store configs and data.<\/li>\n<p><span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> \/root\/data\/docker_data\/<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> \/root\/data\/docker_data\/<\/p>\n<p><span class=\"token function\">wget<\/span> https:\/\/github.com\/pereorga\/minimalist-web-notepad\/archive\/refs\/heads\/docker.zip<\/p>\n<p><span class=\"token function\">unzip<\/span> docker.zip <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token function\">rm<\/span> docker.zip<\/p>\n<p><span class=\"token function\">mv<\/span> minimalist-web-notepad-docker note<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> note<\/p>\n<li>Pull and build by docker compose.<\/li>\n<p><span class=\"token function\">nano<\/span> docker-cpmpose.yml<\/p>\n<p><span class=\"token function\">mkdir<\/span> data<\/p>\n<p><span class=\"token key atrule\">version<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;2.4&#034;<\/span><\/p>\n<p><span class=\"token key atrule\">services<\/span><span class=\"token punctuation\">:<\/span><\/p>\n<p>  minimalist<span class=\"token punctuation\">&#8211;<\/span><span class=\"token key atrule\">web-notepad<\/span><span class=\"token punctuation\">:<\/span><\/p>\n<p>    build<span class=\"token punctuation\">:<\/span> .<\/p>\n<p>    container_name<span class=\"token punctuation\">:<\/span> note<\/p>\n<p>    restart<span class=\"token punctuation\">:<\/span> always<\/p>\n<p>    ports<span class=\"token punctuation\">:<\/span><\/p>\n<p>     <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;nginx\u7f51\u5173ip:8088:80&#034;<\/span>   <span class=\"token comment\">#\u5982\u679c\u8981\u5b9e\u73b0\u53cd\u5411\u4ee3\u7406\u7684\u8bdd&#xff0c;\u5148\u83b7\u53d6nginx\u7684\u7f51\u5173ip<\/span><\/p>\n<p>    volumes<span class=\"token punctuation\">:<\/span><\/p>\n<p>     <span class=\"token punctuation\">&#8211;<\/span> .\/data<span class=\"token punctuation\">:<\/span>\/var\/www\/html\/_tmp<\/p>\n<h4>Uninstall<\/h4>\n<p><span class=\"token builtin class-name\">cd<\/span> \/root\/data\/docker_data\/note<\/p>\n<p><span class=\"token function\">docker<\/span> stop note<\/p>\n<p>Warning\u26a0\ufe0f&#xff1a;If want to delete all your local data and configs<\/p>\n<p><span class=\"token function\">rm<\/span> \/root\/data\/docker_data\/note<\/p>\n<h3>Nginx \u53cd\u5411\u4ee3\u7406\u5de5\u5177<\/h3>\n<h4>\u5bb9\u5668\u901a\u4fe1<\/h4>\n<li>\n<p>\u5bfc\u5165 nginx \u7684\u955c\u50cf&#xff0c;\u8f93\u5165 docker pull jc21\/nginx-proxy-manager ,\u7b49\u5f85\u751f\u6210\u955c\u50cf<\/p>\n<\/li>\n<li>\n<p>\u67e5\u770b\u751f\u6210\u7684\u955c\u50cf\u60c5\u51b5&#xff0c;\u8f93\u5165 docker images.<\/p>\n<\/li>\n<li>\n<p>\u751f\u6210\u4e00\u4e2a\u7279\u5b9a\u7684\u6587\u4ef6\u5939\u4e13\u95e8\u5b58\u653e nginx \u7684\u4e00\u4e9b\u7f13\u5b58\u4fe1\u606f\u7b49&#xff0c;<\/p>\n<\/li>\n<p>   mkdir -p \/root\/data\/docker_data\/<\/p>\n<p>   cd \/root\/data\/docker_data\/<\/p>\n<p>   mkdir nginx<\/p>\n<p>   cd \/nginx\/<\/p>\n<li>\u8bbe\u7f6e docker-compose.yml \u914d\u7f6e\u6587\u4ef6&#xff0c;\u8f93\u5165 &#096;nano docker-compose.yml<\/li>\n<p><span class=\"token key atrule\">services<\/span><span class=\"token punctuation\">:<\/span><br \/>\n<span class=\"token key atrule\">nginx-proxy-manager<\/span><span class=\"token punctuation\">:<\/span><br \/>\n  <span class=\"token key atrule\">image<\/span><span class=\"token punctuation\">:<\/span> jc21\/nginx<span class=\"token punctuation\">&#8211;<\/span>proxy<span class=\"token punctuation\">&#8211;<\/span>manager  <span class=\"token comment\"># \u4f7f\u7528\u52a0\u8f7d\u7684\u955c\u50cf\u540d\u79f0<\/span><br \/>\n  <span class=\"token key atrule\">container_name<\/span><span class=\"token punctuation\">:<\/span> nginx<span class=\"token punctuation\">&#8211;<\/span>proxy<span class=\"token punctuation\">&#8211;<\/span>manager<br \/>\n  <span class=\"token key atrule\">ports<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;80:80&#034;<\/span>      <span class=\"token comment\"># \u6620\u5c04 HTTP \u7aef\u53e3<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;443:443&#034;<\/span>    <span class=\"token comment\"># \u6620\u5c04 HTTPS \u7aef<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token string\">&#034;127.0.0.1:81:81&#034;<\/span><br \/>\n  <span class=\"token key atrule\">volumes<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">.\/data<\/span><span class=\"token punctuation\">:<\/span> \/data  <span class=\"token comment\"># \u6620\u5c04\u670d\u52a1\u5668\u6587\u4ef6\u5939\u4e0e\u5bb9\u5668\u6587\u4ef6\u5939&#xff0c;\u8fdb\u884c\u6301\u4e45\u5316\u6570\u636e<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">\/etc\/letsencrypt<\/span><span class=\"token punctuation\">:<\/span> \/etc\/letsencrypt  <span class=\"token comment\"># \u6302\u8f7d Let&#039;s Encrypt \u8bc1\u4e66\u8def\u5f84<\/span><br \/>\n    <span class=\"token punctuation\">&#8211;<\/span> <span class=\"token key atrule\">.\/html<\/span><span class=\"token punctuation\">:<\/span> \/src\/html   <\/p>\n<p> 5. \u914d\u7f6e\u6210\u529f\u540e&#xff0c;\u8f93\u5165docker compose up\u4e00\u952e\u914d\u7f6e\u5bb9\u5668&#xff0c;\u4e4b\u540e\u8bbf\u95ee 127.0.0.1:81\u3002 &#8211; \u5982\u679c\u662f\u672c\u5730\u4f7f\u7528\u7684\u8bdd&#xff0c;\u53ef\u4ee5\u6b63\u5e38\u6253\u5f00 nginx \u7684\u53ef\u89c6\u5316\u9762\u677f &#8211; \u5982\u679c\u662f\u670d\u52a1\u5668\u7684\u8bdd&#xff0c;\u663e\u793a\u6253\u4e0d\u5f00\u662f\u5e94\u8be5\u5bf9\u5e94\u7684 localhost \u662f\u5728\u672c\u5730\u6253\u5f00&#xff0c;\u9700\u8981\u672c\u5730\u8fde\u63a5\u901a\u8fc7 ssh \u4e0e\u6211\u7684\u670d\u52a1\u5668\u8bbf\u95ee\u8fdb\u884c\u4fee\u6539&#xff0c;\u8f93\u5165ssh -L 8088:127.0.0.1:81 user&#064;your_server_ip \u7136\u540e\u540e\u7eed\u7684\u8bdd\u5c31\u6253\u5f00\u7f51\u9875\u8fdb\u884c\u914d\u7f6e&#xff0c;\u5c06\u6211\u7684\u5b50\u57df\u540d\u4e0e\u6211\u7684 localhost \u8fdb\u884c\u914d\u7f6e\u5c31\u53ef\u4ee5\u901a\u8fc7\u57df\u540d\u76f4\u63a5\u8bbf\u95ee &#8211; Tips: &#8211; **\u5bb9\u5668\u7684localhost** \u662f\u5bb9\u5668\u5185\u90e8\u7684\u7f51\u7edc\u73af\u5883&#xff0c;\u4ec5\u5bf9\u5bb9\u5668\u6709\u6548\u3002 &#8211; **ssh -&#096;** \u7aef\u53e3\u8f6c\u53d1\u901a\u8fc7 SSH \u96a7\u9053\u5c06\u672c\u5730\u7aef\u53e3\u6620\u5c04\u5230\u8fdc\u7a0b\u673a\u5668\u4e0a\u7684\u6307\u5b9a\u7aef\u53e3&#xff0c;\u4ece\u800c\u4f7f\u672c\u5730\u8bbf\u95ee\u7684\u8bf7\u6c42\u80fd\u591f\u901a\u8fc7\u7f51\u7edc\u96a7\u9053\u8f6c\u53d1\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u7684\u670d\u52a1&#xff0c;\u5373\u4f7f\u8be5\u670d\u52a1\u662f\u53ea\u5bf9\u5bb9\u5668\u5185\u90e8\u5f00\u653e\u7684<\/p>\n<h4>Nginx \u5f15\u7528\u9759\u6001\u6587\u4ef6\u53ca 404 \u754c\u9762\u81ea\u5b9a\u4e49<\/h4>\n<ul>\n<li>\n<p>\u6ce8&#xff1a;\u5728\u4f7f\u7528\u9759\u6001\u6587\u4ef6 html \u65f6&#xff0c;\u53ef\u89c6\u5316\u9762\u677f\u7684 cache assets \u4e0d\u52fe\u9009&#xff0c;\u56e0\u4e3a\u5728\u9759\u6001\u6587\u4ef6\u53d8\u66f4\u7684\u65f6\u5019&#xff0c;\u5bf9\u4e8e\u7684\u7f13\u5b58\u4e0d\u4f1a\u5b9e\u65f6\u6539\u53d8<\/p>\n<\/li>\n<li>\n<p>\u5c06\u51c6\u5907\u597d\u7684\u9759\u6001\u6587\u4ef6\u5b58\u653e\u5728\u670d\u52a1\u5668\u786e\u5b9a\u7684\u4f4d\u7f6e&#xff0c;\u4e4b\u540e\u901a\u8fc7\u6253\u5f00 nginx \u53ef\u89c6\u5316\u9762\u677f\u8fdb\u884c\u57df\u540d\u914d\u5bf9\u5df2\u7ecf\u8fdb\u5165 Advance \u914d\u7f6e&#xff0c;\u6dfb\u52a0\u4ee5\u4e0b\u7684\u914d\u7f6e&#xff1a;<\/p>\n<p>location \/ {<br \/>\n    root \/src\/html\/blog;<br \/>\n    index index.html;<\/p>\n<p># \u5bf9 HTML \u6587\u4ef6\u4e0d\u7f13\u5b58<br \/>\n    location ~* \\\\.html$ {<br \/>\n    add_header Cache-Control &#034;no-store, no-cache, must-revalidate, proxy-revalidate, max-age&#061;0&#034;;<br \/>\n    exires -1;<br \/>\n}<\/p>\n<p>     # \u5bf9\u9759\u6001\u8d44\u6e90\u7f13\u5b58 30 \u5929<br \/>\n    location ~* \\\\.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|otf)$ {<br \/>\n    add_header Cache-Control &#034;public, max-age&#061;2592000, immutable&#034;;<br \/>\n    expires 30d;<br \/>\n}<br \/>\n}<\/p>\n<p>location \/blog {<br \/>\n    alias \/src\/html\/blog;<br \/>\n    index index.html;<\/p>\n<p>    # \u5bf9 HTML \u6587\u4ef6\u4e0d\u7f13\u5b58<br \/>\n    location ~* \\\\.html$ {<br \/>\n        add_header Cache-Control &#034;no-store, no-cache, must-revalidate, proxy-revalidate, max-age&#061;0&#034;;<br \/>\n        expires -1;<br \/>\n    }<\/p>\n<p>    # \u5bf9\u9759\u6001\u8d44\u6e90\u7f13\u5b58 30 \u5929<br \/>\n    location ~* \\\\.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|otf)$ {<br \/>\n        add_header Cache-Control &#034;public, max-age&#061;2592000, immutable&#034;;<br \/>\n        expires 30d;<br \/>\n    }<br \/>\n}<\/p>\n<p>error_page 404 505\/error.html;   #\u81ea\u5b9a\u4e49\u754c\u9762\u9519\u8bef<br \/>\nlocation &#061; \/error.html {<br \/>\n    root \/src\/html\/error;<br \/>\n    internal;          #\u53ea\u80fd\u5185\u90e8\u8c03\u7528<br \/>\n}<\/p>\n<p>#\u591a\u4e2a location \u5b9e\u73b0\u540c\u4e00\u4e2a\u4e8c\u7ea7\u57df\u540d\u4e0b\u5b9e\u73b0\u8def\u5f84\u5207\u6362\u4e0d\u540c\u7684\u754c\u9762<br \/>\n#root   \u6307\u5f15\u7684\u662f\u8ddf\u76ee\u5f55&#xff0c;\u9ed8\u8ba4\u8981\u6709\u4e00\u4e2a\u6839\u76ee\u5f55\u6307\u5f15<br \/>\n# alias  \u6307\u5411\u7684\u662f\u57df\u540d\u540e\u7aef\u4e0d\u540c\u8def\u5f84\u5207\u6362\u4e0d\u540c\u7684\u9759\u6001\u754c\u9762<br \/>\n# index \u6307\u5411\u6587\u4ef6\u5939\u4e2d\u7684\u4e3b\u6587\u4ef6\n <\/li>\n<\/ul>\n<h3>Portainer<\/h3>\n<ul>\n<li>\n<p>Portainer \u662f\u4e00\u4e2a\u7b80\u5316 Docker \u548c Kubernetes \u5bb9\u5668\u7ba1\u7406\u7684\u53ef\u89c6\u5316\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u56fe\u5f62\u754c\u9762&#xff0c;\u8ba9\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u3001\u542f\u52a8\u3001\u505c\u6b62\u5bb9\u5668&#xff0c;\u7ba1\u7406\u955c\u50cf\u3001\u7f51\u7edc\u548c\u5377&#xff0c;\u8fd8\u652f\u6301\u65e5\u5fd7\u76d1\u63a7\u548c\u591a\u7528\u6237\u6743\u9650\u7ba1\u7406\u3002Portainer \u9002\u5408\u5f00\u53d1\u3001\u6d4b\u8bd5\u3001\u751f\u4ea7\u7b49\u573a\u666f&#xff0c;\u53ef\u4ee5\u9ad8\u6548\u7ba1\u7406 Docker Swarm \u548c Kubernetes \u96c6\u7fa4\u3002\u9ed8\u8ba4\u8fd0\u884c\u5728 9000 \u7aef\u53e3&#xff0c;\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u5373\u53ef\u4f7f\u7528&#xff0c;\u975e\u5e38\u9002\u5408\u60f3\u8981\u7b80\u5316\u5bb9\u5668\u7ba1\u7406\u7684\u7528\u6237<\/p>\n<\/li>\n<li>\n<p>\u914d\u7f6e\u5176\u4ed6\u5bb9\u5668\u914d\u7f6e\u4e00\u6837\u6240\u793a<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf15\u6b21\u3002\u901a\u8fc7dockers\u5bb9\u5668\uff0c\u8f7b\u677e\u90e8\u7f72\u9879\u76ee\u5230\u670d\u52a1\u5668_\u670d\u52a1\u5668\u90e8\u7f72docker\u5bb9\u5668<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[27,121,43],"topic":[],"class_list":["post-34531","post","type-post","status-publish","format-standard","hentry","category-server","tag-docker","tag-121","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \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\/34531.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf15\u6b21\u3002\u901a\u8fc7dockers\u5bb9\u5668\uff0c\u8f7b\u677e\u90e8\u7f72\u9879\u76ee\u5230\u670d\u52a1\u5668_\u670d\u52a1\u5668\u90e8\u7f72docker\u5bb9\u5668\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/34531.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-29T10:25:42+00:00\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/34531.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/34531.html\",\"name\":\"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-29T10:25:42+00:00\",\"dateModified\":\"2025-04-29T10:25:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/34531.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/34531.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/34531.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668\"}]},{\"@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":"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \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\/34531.html","og_locale":"zh_CN","og_type":"article","og_title":"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb715\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf15\u6b21\u3002\u901a\u8fc7dockers\u5bb9\u5668\uff0c\u8f7b\u677e\u90e8\u7f72\u9879\u76ee\u5230\u670d\u52a1\u5668_\u670d\u52a1\u5668\u90e8\u7f72docker\u5bb9\u5668","og_url":"https:\/\/www.wsisp.com\/helps\/34531.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-29T10:25:42+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/34531.html","url":"https:\/\/www.wsisp.com\/helps\/34531.html","name":"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-29T10:25:42+00:00","dateModified":"2025-04-29T10:25:42+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/34531.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/34531.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/34531.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Dockers\u5bb9\u5668\u5316\u90e8\u7f72\u670d\u52a1\u5668"}]},{"@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\/34531","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=34531"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/34531\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=34531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=34531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=34531"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=34531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}