{"id":44958,"date":"2025-06-21T08:00:56","date_gmt":"2025-06-21T00:00:56","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/44958.html"},"modified":"2025-06-21T08:00:56","modified_gmt":"2025-06-21T00:00:56","slug":"mac%e8%bf%9e%e6%8e%a5%e6%9c%8d%e5%8a%a1%e5%99%a8docker%e5%ae%b9%e5%99%a8%e5%85%a8%e6%94%bb%e7%95%a5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/44958.html","title":{"rendered":"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565"},"content":{"rendered":"<p>\u82f9\u679c\u7535\u8111&#xff08; macOS \u7cfb\u7edf &#xff09;\u8fde\u63a5\u670d\u52a1\u5668\u3001\u914d\u7f6e\u5bb9\u5668&#xff0c;\u6574\u4f53\u601d\u8def\u548c Linux \u7ec8\u7aef\u64cd\u4f5c\u66f4\u8d34\u8fd1&#xff0c;\u4ee5\u4e0b\u7ed3\u5408 macOS \u7279\u70b9&#xff0c;\u8be6\u7ec6\u5206\u6b65\u8bf4\u660e&#xff0c;\u4ee5 Docker \u5bb9\u5668 &#043; \u5e38\u89c1 Linux \u670d\u52a1\u5668&#xff08; \u5982 CentOS\u3001Ubuntu &#xff09;\u4e3a\u4f8b&#xff1a;<\/p>\n<h4>\u4e00\u3001\u8fde\u63a5\u670d\u52a1\u5668&#xff08;SSH \u65b9\u5f0f&#xff0c; macOS \u7ec8\u7aef\u539f\u751f\u652f\u6301 &#xff09;<\/h4>\n<h5>1. \u51c6\u5907\u4fe1\u606f<\/h5>\n<p>\u627e\u8fd0\u7ef4\u6216\u4e91\u5e73\u53f0\u83b7\u53d6&#xff1a;<\/p>\n<ul>\n<li>\u670d\u52a1\u5668\u516c\u7f51 IP&#xff08; \u5982 192.168.1.100 &#xff0c;\u5b9e\u9645\u662f\u516c\u7f51\u53ef\u8bbf\u95ee\u7684 IP &#xff09;<\/li>\n<\/ul>\n<ul>\n<li>\u767b\u5f55\u7528\u6237\u540d&#xff08; \u5982 root \u3001admin \u7b49 &#xff09;<\/li>\n<\/ul>\n<ul>\n<li>\u767b\u5f55\u51ed\u8bc1&#xff1a;\u5bc6\u7801&#xff0c;\u6216 .pem \u683c\u5f0f\u7684\u5bc6\u94a5\u6587\u4ef6&#xff08; \u82e5\u7528\u5bc6\u94a5\u8ba4\u8bc1 &#xff09;<\/li>\n<\/ul>\n<h5>2. \u7ec8\u7aef\u8fde\u63a5\u64cd\u4f5c<\/h5>\n<ul>\n<li>\u5bc6\u7801\u8ba4\u8bc1&#xff1a;<\/li>\n<\/ul>\n<p>\u6253\u5f00 macOS \u201c\u542f\u52a8\u53f0\u201d &#8211; \u201c\u5176\u4ed6\u201d &#8211; \u201c\u7ec8\u7aef\u201d&#xff0c;\u8f93\u5165\u547d\u4ee4&#xff1a;<\/p>\n<p>ssh \u7528\u6237\u540d&#064;\u670d\u52a1\u5668IP<\/p>\n<p>\u6bd4\u5982 ssh root&#064;192.168.1.100 &#xff0c;\u56de\u8f66\u540e\u6309\u63d0\u793a\u8f93\u5165\u5bc6\u7801&#xff0c;\u9a8c\u8bc1\u901a\u8fc7\u5c31\u8fdb\u5165\u670d\u52a1\u5668\u7ec8\u7aef\u3002<\/p>\n<ul>\n<li>\u5bc6\u94a5\u8ba4\u8bc1&#xff1a;<\/li>\n<\/ul>\n<p>\u82e5\u670d\u52a1\u5668\u914d\u7f6e\u4e86\u5bc6\u94a5\u767b\u5f55&#xff0c;\u5148\u628a\u672c\u5730 .pem \u5bc6\u94a5\u6587\u4ef6\u653e\u5230\u5b89\u5168\u76ee\u5f55&#xff08; \u5982 ~\/Documents\/keys\/ &#xff09;&#xff0c;\u5728\u7ec8\u7aef\u7ed9\u5bc6\u94a5\u6587\u4ef6\u8d4b\u6743&#xff08; \u5426\u5219\u53ef\u80fd\u56e0\u6743\u9650\u592a\u5f00\u653e\u65e0\u6cd5\u4f7f\u7528 &#xff09;&#xff1a;<\/p>\n<p>chmod 400 ~\/Documents\/keys\/\u4f60\u7684\u5bc6\u94a5.pem<\/p>\n<p>\u7136\u540e\u8fde\u63a5&#xff1a;<\/p>\n<p>ssh -i ~\/Documents\/keys\/\u4f60\u7684\u5bc6\u94a5.pem \u7528\u6237\u540d&#064;\u670d\u52a1\u5668IP<\/p>\n<p>\u6bd4\u5982 ssh -i ~\/Documents\/keys\/server_key.pem root&#064;192.168.1.100 &#xff0c;\u6210\u529f\u8fde\u63a5\u8fdb\u5165\u670d\u52a1\u5668\u7ec8\u7aef\u3002<\/p>\n<h4>\u4e8c\u3001\u914d\u7f6e\u5bb9\u5668&#xff08;\u4ee5 Docker \u4e3a\u4f8b&#xff0c;\u5047\u8bbe\u670d\u52a1\u5668\u5df2\u88c5 Docker &#xff0c;\u6ca1\u88c5\u7684\u8bdd\u5148\u5728\u670d\u52a1\u5668\u6267\u884c\u5b89\u88c5\u547d\u4ee4 &#xff09;<\/h4>\n<h5>1. \u786e\u8ba4\u670d\u52a1\u5668 Docker \u73af\u5883<\/h5>\n<p>\u5728\u8fde\u63a5\u597d\u7684\u670d\u52a1\u5668\u7ec8\u7aef&#xff0c;\u8f93\u5165 docker -v &#xff0c;\u82e5\u663e\u793a\u7248\u672c\u53f7&#xff08; \u5982 Docker version 24.0.6, build ed223bc &#xff09;&#xff0c;\u8bf4\u660e\u5df2\u88c5&#xff1b;\u6ca1\u88c5\u7684\u8bdd&#xff0c;\u6839\u636e\u670d\u52a1\u5668\u7cfb\u7edf\u88c5&#xff1a;<\/p>\n<ul>\n<li>CentOS\/RHEL&#xff1a;<\/li>\n<\/ul>\n<p>sudo yum install -y docker<\/p>\n<p>sudo systemctl start docker<\/p>\n<p>sudo systemctl enable docker<\/p>\n<ul>\n<li>Ubuntu\/Debian&#xff1a;<\/li>\n<\/ul>\n<p>sudo apt update<\/p>\n<p>sudo apt install -y docker.io<\/p>\n<p>sudo systemctl start docker<\/p>\n<p>sudo systemctl enable docker<\/p>\n<h5>2. \u62c9\u53d6\u955c\u50cf&#xff08; \u5bb9\u5668 \u201c\u6a21\u677f\u201d &#xff09;<\/h5>\n<p>\u5047\u8bbe\u4f60\u8981\u8fd0\u884c Python \u811a\u672c img_class.py &#xff0c;\u5148\u62c9\u53d6 Python \u57fa\u7840\u955c\u50cf&#xff0c;\u7ec8\u7aef\u6267\u884c&#xff1a;<\/p>\n<p>docker pull python:3.10-slim # \u62c9\u53d6 Python 3.10 \u7cbe\u7b80\u7248\u955c\u50cf&#xff0c;\u6309\u9700\u6362\u7248\u672c<\/p>\n<h5>3. \u51c6\u5907\u4ee3\u7801 \/ \u6587\u4ef6&#xff08; \u82e5\u9700\u8981\u6302\u8f7d\u672c\u5730\u4ee3\u7801\u5230\u5bb9\u5668 &#xff09;<\/h5>\n<p>\u5982\u679c img_class.py \u5728\u4f60 Mac \u672c\u5730&#xff0c;\u60f3\u6302\u8f7d\u5230\u670d\u52a1\u5668\u5bb9\u5668\u91cc\u8fd0\u884c&#xff0c;\u9700\u8981&#xff1a;<\/p>\n<ul>\n<li>\u5728 Mac \u7ec8\u7aef&#xff0c;\u628a\u4ee3\u7801\u4f20\u5230\u670d\u52a1\u5668&#xff08; \u7528 scp \u547d\u4ee4 &#xff09;&#xff1a;<\/li>\n<\/ul>\n<p>scp \/\u672c\u5730\u8def\u5f84\/img_class.py \u7528\u6237\u540d&#064;\u670d\u52a1\u5668IP:\/\u670d\u52a1\u5668\u76ee\u6807\u8def\u5f84 <\/p>\n<p>\u6bd4\u5982 scp ~\/Desktop\/img_class.py root&#064;192.168.1.100:\/home\/code\/ &#xff0c;\u628a\u672c\u5730\u684c\u9762\u7684\u811a\u672c\u4f20\u5230\u670d\u52a1\u5668 \/home\/code\/ \u76ee\u5f55\u3002<\/p>\n<h5>4. \u521b\u5efa\u5e76\u8fd0\u884c\u5bb9\u5668<\/h5>\n<p>\u5728\u670d\u52a1\u5668\u7ec8\u7aef&#xff0c;\u7528 docker run \u547d\u4ee4\u542f\u52a8\u5bb9\u5668&#xff0c;\u7ed3\u5408\u6302\u8f7d\u3001\u7aef\u53e3\u6620\u5c04\u7b49\u9700\u6c42&#xff0c;\u793a\u4f8b&#xff1a;<\/p>\n<p>docker run -it -d \\\\<\/p>\n<p>&#8211;name sjys_img_class \\\\ # \u5bb9\u5668\u547d\u540d&#xff0c;\u81ea\u5b9a\u4e49<\/p>\n<p>-v \/\u670d\u52a1\u5668\u4ee3\u7801\u76ee\u5f55:\/\u5bb9\u5668\u5185\u76ee\u5f55 \\\\ # \u6302\u8f7d\u76ee\u5f55&#xff0c;\u5982 &#096;-v \/home\/code\/:\/app\/&#096; &#xff0c;\u628a\u670d\u52a1\u5668 &#096;\/home\/code\/&#096; \u6302\u8f7d\u5230\u5bb9\u5668 &#096;\/app\/&#096; <\/p>\n<p>-p \u672c\u5730\u7aef\u53e3:\u5bb9\u5668\u7aef\u53e3 \\\\ # \u82e5\u811a\u672c\u6709\u7f51\u7edc\u670d\u52a1&#xff08; \u5982 Flask &#xff09;&#xff0c;\u6620\u5c04\u7aef\u53e3&#xff0c;\u5982 &#096;-p 8000:5000&#096; &#xff0c;\u672c\u5730\u8bbf\u95ee 8000 \u8f6c\u53d1\u5230\u5bb9\u5668 5000<\/p>\n<p>python:3.10-slim \\\\ # \u4f7f\u7528\u7684\u955c\u50cf<\/p>\n<p>python \/\u5bb9\u5668\u5185\u76ee\u5f55\/img_class.py # \u5bb9\u5668\u542f\u52a8\u540e\u6267\u884c\u7684\u547d\u4ee4&#xff0c;\u5982\u811a\u672c\u5728\u5bb9\u5668 &#096;\/app\/&#096; &#xff0c;\u5c31\u662f &#096;python \/app\/img_class.py&#096; <\/p>\n<p>\u89e3\u91ca\u5173\u952e\u53c2\u6570&#xff1a;<\/p>\n<ul>\n<li>-it &#xff1a;\u5206\u914d\u4ea4\u4e92\u7ec8\u7aef&#xff0c;\u65b9\u4fbf\u8c03\u8bd5&#xff1b;-d &#xff1a;\u540e\u53f0\u8fd0\u884c<\/li>\n<\/ul>\n<ul>\n<li>&#8211;name &#xff1a;\u81ea\u5b9a\u4e49\u5bb9\u5668\u540d&#xff0c;\u65b9\u4fbf\u7ba1\u7406<\/li>\n<\/ul>\n<ul>\n<li>-v &#xff1a;\u6302\u8f7d\u5377&#xff0c;\u8ba9\u670d\u52a1\u5668\u76ee\u5f55\u548c\u5bb9\u5668\u76ee\u5f55\u5171\u4eab\u6587\u4ef6&#xff08; \u82e5\u4ee3\u7801\u5728\u670d\u52a1\u5668&#xff0c;\u4e5f\u53ef\u76f4\u63a5\u6302\u8f7d\u670d\u52a1\u5668\u76ee\u5f55 &#xff1b;\u82e5\u60f3\u4ece Mac \u76f4\u63a5\u6302\u8f7d&#xff0c;\u9700\u670d\u52a1\u5668\u652f\u6301 NFS \u7b49\u5171\u4eab&#xff0c;\u7a0d\u590d\u6742&#xff0c;\u65b0\u624b\u5148\u4f20\u4ee3\u7801\u5230\u670d\u52a1\u5668\u518d\u6302\u8f7d\u66f4\u7b80\u5355 &#xff09;<\/li>\n<\/ul>\n<ul>\n<li>-p &#xff1a;\u7aef\u53e3\u6620\u5c04&#xff0c;\u5916\u90e8\u8bbf\u95ee\u670d\u52a1\u5668 IP &#043; \u672c\u5730\u7aef\u53e3&#xff0c;\u5c31\u80fd\u8bbf\u95ee\u5bb9\u5668\u5185\u670d\u52a1<\/li>\n<\/ul>\n<h5>5. \u7ba1\u7406\u5bb9\u5668&#xff08; \u670d\u52a1\u5668\u7ec8\u7aef\u64cd\u4f5c &#xff09;<\/h5>\n<ul>\n<li>\u67e5\u770b\u5bb9\u5668\u72b6\u6001&#xff1a;<\/li>\n<\/ul>\n<p>docker ps # \u770b\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668<\/p>\n<p>docker ps -a # \u770b\u6240\u6709\u5bb9\u5668&#xff08; \u5305\u62ec\u5df2\u505c\u6b62 &#xff09;<\/p>\n<ul>\n<li>\u8fdb\u5165\u5bb9\u5668\u7ec8\u7aef&#xff1a;<\/li>\n<\/ul>\n<p>docker exec -it \u5bb9\u5668\u540d\/\u5bb9\u5668ID \/bin\/bash <\/p>\n<p>\u6bd4\u5982 docker exec -it sjys_img_class \/bin\/bash &#xff0c;\u8fdb\u5165\u540e\u53ef\u6267\u884c pip install \u4f9d\u8d56\u5305 \u88c5\u811a\u672c\u9700\u8981\u7684\u5e93&#xff0c;\u6216\u8c03\u8bd5\u4ee3\u7801\u3002<\/p>\n<ul>\n<li>\u505c\u6b62 \/ \u542f\u52a8\u5bb9\u5668&#xff1a;<\/li>\n<\/ul>\n<p>docker stop \u5bb9\u5668\u540d\/ID # \u505c\u6b62<\/p>\n<p>docker start \u5bb9\u5668\u540d\/ID # \u542f\u52a8<\/p>\n<h4>\u4e09\u3001\u8fdb\u9636\u8865\u5145&#xff08; \u82e5\u6d89\u53ca Docker Compose &#xff09;<\/h4>\n<p>\u5982\u679c\u5bb9\u5668\u914d\u7f6e\u590d\u6742&#xff08; \u591a\u670d\u52a1\u3001\u7f51\u7edc\u3001\u5377 &#xff09;&#xff0c;\u63a8\u8350\u7528 Docker Compose \u7ba1\u7406\u3002<\/p>\n<h5>1. \u5728\u670d\u52a1\u5668\u5b89\u88c5 Docker Compose<\/h5>\n<p># \u4e0b\u8f7d Compose \u4e8c\u8fdb\u5236\u6587\u4ef6&#xff08; \u9002\u7528\u4e8e Linux x86_64 &#xff09;<\/p>\n<p>sudo curl -L &#034;https:\/\/github.com\/docker\/compose\/releases\/latest\/download\/docker-compose-$(uname -s)-$(uname -m)&#034; -o \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u8d4b\u6743<\/p>\n<p>sudo chmod &#043;x \/usr\/local\/bin\/docker-compose<\/p>\n<p># \u9a8c\u8bc1<\/p>\n<p>docker-compose -v<\/p>\n<h5>2. \u7f16\u5199 docker-compose.yml \u6587\u4ef6<\/h5>\n<p>\u5728\u670d\u52a1\u5668\u521b\u5efa docker-compose.yml &#xff0c;\u793a\u4f8b&#xff08; \u9488\u5bf9 Python \u811a\u672c\u573a\u666f &#xff09;&#xff1a;<\/p>\n<p>version: &#039;3&#039;<\/p>\n<p>services:<\/p>\n<p>sjys_img_class:<\/p>\n<p>image: python:3.10-slim<\/p>\n<p>container_name: sjys_img_class<\/p>\n<p>volumes:<\/p>\n<p>&#8211; \/\u670d\u52a1\u5668\u4ee3\u7801\u76ee\u5f55:\/app # \u6302\u8f7d\u4ee3\u7801<\/p>\n<p>ports:<\/p>\n<p>&#8211; &#034;8000:5000&#034; # \u7aef\u53e3\u6620\u5c04<\/p>\n<p>command: &#034;python \/app\/img_class.py&#034; # \u542f\u52a8\u547d\u4ee4<\/p>\n<h5>3. \u542f\u52a8 \/ \u7ba1\u7406<\/h5>\n<p>\u5728 docker-compose.yml \u6240\u5728\u76ee\u5f55&#xff0c;\u6267\u884c&#xff1a;<\/p>\n<p>docker-compose up -d # \u540e\u53f0\u542f\u52a8<\/p>\n<p>docker-compose logs # \u770b\u65e5\u5fd7<\/p>\n<p>docker-compose stop # \u505c\u6b62<\/p>\n<h4>\u56db\u3001\u6ce8\u610f\u4e8b\u9879<\/h4>\n<li>\u6743\u9650\u95ee\u9898&#xff1a;\u6302\u8f7d\u76ee\u5f55\u3001\u64cd\u4f5c\u5bb9\u5668\u65f6&#xff0c;\u6ce8\u610f\u7528\u6237\u6743\u9650&#xff0c;\u5fc5\u8981\u65f6\u52a0 sudo &#xff0c;\u6216\u914d\u7f6e Docker \u514d sudo &#xff08; sudo usermod -aG docker \u7528\u6237\u540d &#xff0c;\u7136\u540e\u91cd\u65b0\u767b\u5f55\u670d\u52a1\u5668\u7ec8\u7aef &#xff09;\u3002<\/li>\n<li>\u7f51\u7edc\u5b89\u5168&#xff1a;\u670d\u52a1\u5668\u7aef\u53e3&#xff08; \u5982 8000 &#xff09;\u82e5\u8981\u516c\u7f51\u8bbf\u95ee&#xff0c;\u9700\u5728\u4e91\u5e73\u53f0\u63a7\u5236\u53f0\u914d\u7f6e\u5b89\u5168\u7ec4 \/ \u9632\u706b\u5899\u89c4\u5219&#xff0c;\u653e\u884c\u5bf9\u5e94\u7aef\u53e3\u3002<\/li>\n<li>\u955c\u50cf \/ \u4f9d\u8d56&#xff1a;\u82e5 img_class.py \u4f9d\u8d56\u7279\u6b8a\u5e93&#xff0c;\u9700\u5728\u5bb9\u5668\u542f\u52a8\u540e\u7528 docker exec \u8fdb\u5165&#xff0c;\u6216\u5728 Dockerfile \u91cc\u63d0\u524d\u88c5&#xff08; \u8fdb\u9636\u53ef\u5199 Dockerfile \u6784\u5efa\u81ea\u5b9a\u4e49\u955c\u50cf &#xff09;\u3002<\/li>\n<p>\u8981\u662f\u4f60\u7528\u7684\u5bb9\u5668\u6280\u672f\u4e0d\u662f Docker &#xff08; \u5982 Podman &#xff09;&#xff0c;\u6216\u670d\u52a1\u5668\u7cfb\u7edf\u6709\u7279\u6b8a\u914d\u7f6e&#xff0c;\u53ef\u8865\u5145\u8bf4\u660e\u518d\u7ec6\u5316&#xff5e;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb707\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Mac\u8fde\u63a5\u670d\u52a1\u5668\u4e0e\u914d\u7f6eDocker\u5bb9\u5668\u6307\u5357 \u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Mac\u7ec8\u7aef\u901a\u8fc7SSH\u8fde\u63a5Linux\u670d\u52a1\u5668\uff08\u652f\u6301\u5bc6\u7801\/\u5bc6\u94a5\u8ba4\u8bc1\uff09\uff0c\u4ee5\u53ca\u914d\u7f6eDocker\u5bb9\u5668\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u5305\u62ec\uff1a1)\u670d\u52a1\u5668\u8fde\u63a5\u65b9\u6cd5\uff1b2)Docker\u73af\u5883\u68c0\u67e5\u4e0e\u5b89\u88c5\uff1b3)\u955c\u50cf\u62c9\u53d6\u4e0e\u5bb9\u5668\u8fd0\u884c\uff08\u542b\u76ee\u5f55\u6302\u8f7d\u548c\u7aef\u53e3\u6620\u5c04\uff09\uff1b4)\u5bb9\u5668\u7ba1\u7406\u57fa\u672c\u547d\u4ee4\uff1b5)Docker Compose\u8fdb\u9636\u4f7f\u7528\u65b9\u6cd5\u3002\u540c\u65f6\u63d0\u4f9b\u4e86\u6743\u9650\u7ba1\u7406\u3001\u7f51\u7edc\u5b89\u5168\u7b49\u6ce8\u610f\u4e8b\u9879\uff0c\u5e2e\u52a9Mac\u7528\u6237\u5feb\u901f\u5b9e\u73b0\u670d\u52a1\u5668\u5bb9\u5668\u5316\u90e8\u7f72\u3002\u64cd\u4f5c\u6b65\u9aa4\u5747\u7ed3\u5408Mac\u7ec8\u7aef\u7279\u6027\u4e0eLinux\u670d\u52a1\u5668\u73af\u5883\u8fdb\u884c\u8bf4\u660e\uff0c\u9002\u7528\u4e8eCentOS\/Ubuntu\u7b49<\/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":[81,50,190],"topic":[],"class_list":["post-44958","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-50","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \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\/44958.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb707\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Mac\u8fde\u63a5\u670d\u52a1\u5668\u4e0e\u914d\u7f6eDocker\u5bb9\u5668\u6307\u5357 \u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Mac\u7ec8\u7aef\u901a\u8fc7SSH\u8fde\u63a5Linux\u670d\u52a1\u5668\uff08\u652f\u6301\u5bc6\u7801\/\u5bc6\u94a5\u8ba4\u8bc1\uff09\uff0c\u4ee5\u53ca\u914d\u7f6eDocker\u5bb9\u5668\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u5305\u62ec\uff1a1)\u670d\u52a1\u5668\u8fde\u63a5\u65b9\u6cd5\uff1b2)Docker\u73af\u5883\u68c0\u67e5\u4e0e\u5b89\u88c5\uff1b3)\u955c\u50cf\u62c9\u53d6\u4e0e\u5bb9\u5668\u8fd0\u884c\uff08\u542b\u76ee\u5f55\u6302\u8f7d\u548c\u7aef\u53e3\u6620\u5c04\uff09\uff1b4)\u5bb9\u5668\u7ba1\u7406\u57fa\u672c\u547d\u4ee4\uff1b5)Docker Compose\u8fdb\u9636\u4f7f\u7528\u65b9\u6cd5\u3002\u540c\u65f6\u63d0\u4f9b\u4e86\u6743\u9650\u7ba1\u7406\u3001\u7f51\u7edc\u5b89\u5168\u7b49\u6ce8\u610f\u4e8b\u9879\uff0c\u5e2e\u52a9Mac\u7528\u6237\u5feb\u901f\u5b9e\u73b0\u670d\u52a1\u5668\u5bb9\u5668\u5316\u90e8\u7f72\u3002\u64cd\u4f5c\u6b65\u9aa4\u5747\u7ed3\u5408Mac\u7ec8\u7aef\u7279\u6027\u4e0eLinux\u670d\u52a1\u5668\u73af\u5883\u8fdb\u884c\u8bf4\u660e\uff0c\u9002\u7528\u4e8eCentOS\/Ubuntu\u7b49\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/44958.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-21T00:00:56+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\/44958.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/44958.html\",\"name\":\"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-21T00:00:56+00:00\",\"dateModified\":\"2025-06-21T00:00:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/44958.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/44958.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/44958.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565\"}]},{\"@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":"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \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\/44958.html","og_locale":"zh_CN","og_type":"article","og_title":"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb707\u6b21\uff0c\u70b9\u8d5e12\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Mac\u8fde\u63a5\u670d\u52a1\u5668\u4e0e\u914d\u7f6eDocker\u5bb9\u5668\u6307\u5357 \u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Mac\u7ec8\u7aef\u901a\u8fc7SSH\u8fde\u63a5Linux\u670d\u52a1\u5668\uff08\u652f\u6301\u5bc6\u7801\/\u5bc6\u94a5\u8ba4\u8bc1\uff09\uff0c\u4ee5\u53ca\u914d\u7f6eDocker\u5bb9\u5668\u7684\u5b8c\u6574\u6d41\u7a0b\u3002\u5305\u62ec\uff1a1)\u670d\u52a1\u5668\u8fde\u63a5\u65b9\u6cd5\uff1b2)Docker\u73af\u5883\u68c0\u67e5\u4e0e\u5b89\u88c5\uff1b3)\u955c\u50cf\u62c9\u53d6\u4e0e\u5bb9\u5668\u8fd0\u884c\uff08\u542b\u76ee\u5f55\u6302\u8f7d\u548c\u7aef\u53e3\u6620\u5c04\uff09\uff1b4)\u5bb9\u5668\u7ba1\u7406\u57fa\u672c\u547d\u4ee4\uff1b5)Docker Compose\u8fdb\u9636\u4f7f\u7528\u65b9\u6cd5\u3002\u540c\u65f6\u63d0\u4f9b\u4e86\u6743\u9650\u7ba1\u7406\u3001\u7f51\u7edc\u5b89\u5168\u7b49\u6ce8\u610f\u4e8b\u9879\uff0c\u5e2e\u52a9Mac\u7528\u6237\u5feb\u901f\u5b9e\u73b0\u670d\u52a1\u5668\u5bb9\u5668\u5316\u90e8\u7f72\u3002\u64cd\u4f5c\u6b65\u9aa4\u5747\u7ed3\u5408Mac\u7ec8\u7aef\u7279\u6027\u4e0eLinux\u670d\u52a1\u5668\u73af\u5883\u8fdb\u884c\u8bf4\u660e\uff0c\u9002\u7528\u4e8eCentOS\/Ubuntu\u7b49","og_url":"https:\/\/www.wsisp.com\/helps\/44958.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-21T00:00:56+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\/44958.html","url":"https:\/\/www.wsisp.com\/helps\/44958.html","name":"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-21T00:00:56+00:00","dateModified":"2025-06-21T00:00:56+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/44958.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/44958.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/44958.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Mac\u8fde\u63a5\u670d\u52a1\u5668Docker\u5bb9\u5668\u5168\u653b\u7565"}]},{"@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\/44958","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=44958"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/44958\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=44958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=44958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=44958"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=44958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}