{"id":200898,"date":"2025-05-06T13:57:31","date_gmt":"2025-05-06T05:57:31","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200898\/"},"modified":"2025-05-06T13:57:31","modified_gmt":"2025-05-06T05:57:31","slug":"%e5%9c%a8windows-%e7%8e%af%e5%a2%83%e4%b8%8b%ef%bc%8c%e5%a6%82%e4%bd%95%e4%bf%ae%e6%94%b9-docker-%e5%ae%b9%e5%99%a8%e5%8f%82%e6%95%b0%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200898\/","title":{"rendered":"\u5728Windows \u73af\u5883\u4e0b\uff0c\u5982\u4f55\u4fee\u6539 Docker \u5bb9\u5668\u53c2\u6570\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u5728Windows \u73af\u5883\u4e0b\uff0c\u5982\u4f55\u4fee\u6539 Docker \u5bb9\u5668\u53c2\u6570\uff1f<\/h1>\n<p>\u6570\u636e\u5e93\u5c0f\u767d\u4e00\u679a\uff0c\u6b63\u5728\u4e0d\u65ad\u5b66\u4e60\u79ef\u7d2f\u77e5\u8bc6\uff0c\u73b0\u5c06\u5b66\u4e60\u5230\u7684\u77e5\u8bc6\u8bb0\u5f55\u4e00\u4e0b\uff0c\u4e5f\u662f\u5c06\u6211\u7684\u6240\u5f97\u5206\u4eab\u7ed9\u5927\u5bb6\uff01\u800c\u4eca\u5929\u8fd9\u7bc7\u6587\u7ae0\u300a\u5728Windows \u73af\u5883\u4e0b\uff0c\u5982\u4f55\u4fee\u6539 Docker \u5bb9\u5668\u53c2\u6570\uff1f\u300b\u5e26\u5927\u5bb6\u6765\u4e86\u89e3\u4e00\u4e0b##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u4ece\u800c\u5f25\u8865\u81ea\u5df1\u7684\u4e0d\u8db3\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241119\/1732010274673c61223ad53.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>windows \u73af\u5883\u4e0b\u4fee\u6539 docker \u5bb9\u5668\u53c2\u6570\u6307\u5357<\/strong><\/p>\n<p>\u5728 windows \u73af\u5883\u4e0b\u7ba1\u7406 docker \u5bb9\u5668\u65f6\uff0c\u7528\u6237\u6709\u65f6\u9700\u8981\u4fee\u6539\u5bb9\u5668\u53c2\u6570\uff0c\u4f8b\u5982\u7aef\u53e3\u53f7\u3001\u5b57\u7b26\u7f16\u7801\u6216 binlog \u4f4d\u7f6e\u3002<\/p>\n<p><strong>\u65b9\u6cd5\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u83b7\u53d6\u5bb9\u5668\u8be6\u7ec6\u4fe1\u606f\uff1a<\/strong><\/p>\n<p>\u8fd0\u884c docker inspect [\u5bb9\u5668\u540d\u79f0] \u547d\u4ee4\u4ee5\u83b7\u53d6\u5bb9\u5668\u7684\u8be6\u7ec6\u914d\u7f6e\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u81ea\u5b9a\u4e49 dockerfile\uff1a<\/strong><\/p>\n<p>\u6839\u636e\u81ea\u5df1\u9700\u6c42\uff0c\u521b\u5efa\u5305\u542b\u4fee\u6539\u540e\u53c2\u6570\u7684\u65b0 dockerfile\u3002\u4f8b\u5982\uff0c\u8981\u4fee\u6539\u7aef\u53e3\u53f7\uff1a<\/p>\n<pre>FROM [\u57fa\u7840\u955c\u50cf]\nEXPOSE 3306<\/pre>\n<\/li>\n<li>\n<p><strong>\u6784\u5efa\u65b0\u955c\u50cf\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528 docker build [\u76ee\u5f55\u8def\u5f84] \u547d\u4ee4\u6784\u5efa\u5305\u542b\u81ea\u5b9a\u4e49\u53c2\u6570\u7684\u65b0\u955c\u50cf\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u65b0\u5bb9\u5668\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528 docker run [\u65b0\u955c\u50cf\u540d\u79f0] \u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u57fa\u4e8e\u65b0\u955c\u50cf\u7684\u65b0\u5bb9\u5668\u3002<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u5176\u4ed6\u8c03\u6574\u9014\u5f84\uff1a<\/strong><\/p>\n<p>\u9664\u4e86\u4f7f\u7528 dockerfile \u5916\uff0c\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u9014\u5f84\u53ef\u4ee5\u8c03\u6574\u5bb9\u5668\u53c2\u6570\uff1a<\/p>\n<ul>\n<li><strong>\u4f7f\u7528\u73af\u5883\u53d8\u91cf\uff1a<\/strong>\u53ef\u4ee5\u5728\u542f\u52a8\u5bb9\u5668\u65f6\u4e3a\u5bb9\u5668\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002<\/li>\n<li><strong>\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong>\u53ef\u4ee5\u5c06\u914d\u7f6e\u4fe1\u606f\u5b58\u50a8\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u5e76\u5c06\u5176\u6302\u8f7d\u5230\u5bb9\u5668\u4e2d\u3002<\/li>\n<li><strong>\u6302\u8f7d\u81ea\u5b9a\u4e49\u76ee\u5f55\uff1a<\/strong>\u53ef\u4ee5\u5c06\u81ea\u5b9a\u4e49\u76ee\u5f55\u6302\u8f7d\u5230\u5bb9\u5668\u4e2d\uff0c\u5176\u4e2d\u5305\u542b\u4e0e\u5bb9\u5668\u4ea4\u4e92\u6240\u9700\u7684\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p><strong>\u53c2\u8003\u6587\u6863\uff1a<\/strong><\/p>\n<ul>\n<li>[\u4f7f\u7528 dockerfile \u8c03\u6574\u5bb9\u5668\u53c2\u6570](https:\/\/docs.docker.com\/engine\/reference\/builder\/#modifier-instructions)<\/li>\n<li>[\u914d\u7f6e windows \u5bb9\u5668](https:\/\/docs.docker.com\/docker-for-windows\/configs\/)<\/li>\n<\/ul>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5728Windows \u73af\u5883\u4e0b\uff0c\u5982\u4f55\u4fee\u6539 Docker \u5bb9\u5668\u53c2\u6570\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Windows \u73af\u5883\u4e0b\uff0c\u5982\u4f55\u4fee&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200898","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200898"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200898\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}