{"id":138106,"date":"2020-07-21T04:02:10","date_gmt":"2020-07-20T20:02:10","guid":{"rendered":"http:\/\/4563.org\/?p=138106"},"modified":"2020-07-21T04:02:10","modified_gmt":"2020-07-20T20:02:10","slug":"%e9%97%ae%e4%b8%80%e4%b8%aa-docker-%e5%ae%b9%e5%99%a8%e5%90%8d%ef%bc%88docker-compose-%e6%9c%8d%e5%8a%a1%e5%90%8d%ef%bc%89%e8%a7%a3%e6%9e%90%e5%88%b0-ip-%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%8c%e8%af%a5","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=138106","title":{"rendered":"\u95ee\u4e00\u4e2a docker \u5bb9\u5668\u540d\uff08docker-compose \u670d\u52a1\u540d\uff09\u89e3\u6790\u5230 IP \u7684\u95ee\u9898\uff0c\u8be5\u600e\u4e48\u5904\u7406"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u95ee\u4e00\u4e2a docker \u5bb9\u5668\u540d\uff08docker-compose \u670d\u52a1\u540d\uff09\u89e3\u6790\u5230 IP \u7684\u95ee\u9898\uff0c\u8be5\u600e\u4e48\u5904\u7406               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwerthhusn <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u7528<code>docker-compose<\/code>\u542f\u52a8\u4e24\u4e2a\u670d\u52a1\uff1a<\/p>\n<ul>\n<li>\u670d\u52a1<code>sa<\/code>\uff0c\u5bb9\u5668 IP \u5730\u5740\u662f\u81ea\u52a8\u5206\u914d\u7684<code>10.0.0.12<\/code><\/li>\n<li>\u670d\u52a1<code>sb<\/code>\uff0c\u5bb9\u5668 IP \u5730\u5740\u662f\u81ea\u52a8\u5206\u914d\u7684<code>10.0.0.13<\/code><\/li>\n<\/ul>\n<p>\u5176\u4ed6\u670d\u52a1\u6307\u5b9a\u4e86\u8fd9\u4e24\u4e2a\u670d\u52a1\uff0c\u6bd4\u5982 nginx \u7684 upstream<\/p>\n<pre><code>upstream sa {   server sa:12345;   keepalive 1024; } <\/code><\/pre>\n<p>\u7136\u540e\uff0c\u505c\u6389\u8fd9\u4e24\u4e2a\u670d\u52a1<code>docker-compose stop sa sb<\/code>\uff0c\u7136\u540e\u5148\u542f\u52a8 sb\uff0c\u8fd9\u65f6\u5019 sb \u4f1a\u62ff\u5230\u5730\u5740<code>10.0.0.12<\/code>\uff0c\u518d\u542f\u52a8 sa\uff0c\u8fd9\u65f6\u5019 sa \u4f1a\u62ff\u5230\u5730\u5740<code>10.0.0.13<\/code>\uff0c\u8ddf\u4e4b\u524d\u7ffb\u4e86\u4e2a\u4e2a\u3002<\/p>\n<p><strong>\u6b64\u65f6\u95ee\u9898\u5c31\u51fa\u73b0\u4e86\uff0cNginx \u7f13\u5b58\u4e86 host \u4e0e IP \u7684\u5173\u7cfb\uff0c\u5bfc\u81f4\u53cd\u5411\u4ee3\u7406\u5230\u4e86&#8221;\u9519\u8bef&#8221;\u7684\u5730\u5740<\/strong><\/p>\n<p>\u9664\u4e86 nginx \u4e4b\u5916\uff0c\u4e0d\u77e5\u9053\u5176\u4ed6\u7684\u5404\u5f0f\u5404\u6837\u7684\u8f6f\u4ef6\u4f1a\u4e0d\u4f1a\u4e5f\u4f1a\u6709\u7c7b\u4f3c\u7684\u95ee\u9898\uff0c\u5c31\u662f\u914d\u7f6e\u7684\u4e0d\u662f IP \u5730\u5740\u800c\u662f\u5bb9\u5668\u7684 host \u540d\u5b57\uff0c\u4f9d\u8d56\u7684\u5bb9\u5668 IP \u53d1\u751f\u4e86\u53d8\u5316\uff0c\u4e00\u822c\u8fd9\u79cd\u95ee\u9898\u8be5\u548b\u5904\u7406?????<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2568699\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yiplee <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/github.com\/nginx-proxy\/nginx-proxy<\/p>\n<p>\u770b\u8fd9\u4e2a                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2568700\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             nginx \u53ef\u4ee5 proxy_pass \u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u8fd9\u6837\u4f1a\u5bfc\u81f4\u4e00\u4e2a delayed evaluate \u884c\u4e3a\uff0c\u5c31\u80fd\u53cd\u6620\u51fa\u6765 DNS \u7684\u53d8\u5316\u4e86<br \/>\u5176\u4ed6\u8f6f\u4ef6\u4e0d\u4e86\u89e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2568701\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qwerthhusn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @julyclyde \u90a3\u8fd9\u79cd\u60c5\u51b5\u5e94\u8be5\u548b\u5904\u7406\u5462\uff1f\u6211\u8bd5\u4e86\u4e0b resolver valid \u65f6\u6548\uff0c\u53d1\u73b0\u6ca1\u6709\u4f5c\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u4e00\u4e2a docker \u5bb9\u5668\u540d\uff08do&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/138106"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=138106"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/138106\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=138106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=138106"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=138106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}