[I] [BUG] 快速入门(Docker):real request与upstreamUrl的示例配置易使新手因网络上下文混淆而连接失败 [shenyu]</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="/search?l=notifications@shenyu.apache.org&q=from:%22via+GitHub%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">via GitHub</span></span></a></span> <span class="date"><a href="/search?l=notifications@shenyu.apache.org&q=date:20250508" rel="nofollow">Thu, 08 May 2025 20:45:19 -0700</a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre> fantasy-lotus opened a new issue, #6020: URL: <a rel="nofollow" href="https://github.com/apache/shenyu/issues/6020">https://github.com/apache/shenyu/issues/6020</a></pre><pre> ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior 在阅读了官方README的快速上手部署容器后,我在 macOS 宿主机上启动了一个监听 127.0.0.1:8080 的 HelloWorld 后端服务,并严格按照指南启动 shenyu-admin 和 shenyu-bootstrap 容器(均在 shenyu Docker 网络中)并配置了selectorHandler,当尝试通过网关(<a rel="nofollow" href="http://localhost:9195/helloworld)访问后端服务时,shenyu-bootstrap">http://localhost:9195/helloworld)访问后端服务时,shenyu-bootstrap</a> 容器日志显示它尝试连接自身内部的 127.0.0.1:8080,而不是宿主机上运行的后端服务。这直接导致了 Connection refused 错误❌ ### Expected Behavior 原因是我启动的后端HelloWorld服务在宿主机上,容器内部访问127.0.0.1无法映射到宿主机 仔细阅读了文档后,可能的意思是 1. 后端服务被打包并运行在了 shenyu-bootstrap 容器的内部,并且监听了这个容器自己的 127.0.0.1 (localhost) 的 8080 端口(不太可能) 2. 在docker shenyu network中,用户需要自己部署一个后端服务, **但文档本身并没有提供启动这个示例后端服务的步骤** 🤯新手困惑的原因: 在 Docker 环境下,shenyu-bootstrap 容器内的 127.0.0.1:8080 指向的是该容器自身 对于Docker 网络上下文不太熟悉的用户(以前的我),可能期望快速上手提供一个无需修改就能直接工作的端到端示例,容易将 127.0.0.1:8080 理解为宿主机的 localhost 💡可能的解决方案: 1. 引导用户在**宿主机**上启动后端服务并监听localhost:8080, **同时把upstreamUrl改为host.docker.internal:8080** 2. 提供在docker shenyu network中启动后端示例服务的步骤 ### Steps To Reproduce 按照快速上手(docker)部署shenyu并配置selectorHandler upstreamUrl为127.0.0.1:8080, 同时在宿主机启动后端服务 ### Environment ```markdown ShenYu version(s):docker latest 运行环境:macOS (Docker Desktop) ``` ### Debug logs [0a883217-38] formatError:Resolved [AnnotatedConnectException: finishConnect(..) failed: Connection refused: /127.0.0.1:8080] for HTTP GET /favicon.ico throwable: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /127.0.0.1:8080 ### Anything else? _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org </pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg33106.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="index.html#33109">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="maillist.html#33109">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg33130.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email tSliceCur"><span class="subject">[I] [BUG] <title>快速入门(Docker):real request与upstreamUrl的示例...</span> <span class="sender italic">via GitHub</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg33130.html">Re: [I] [Documentation] 快速入门(Docker):real request与upstream...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg33132.html">Re: [I] [Documentation] 快速入门(Docker):real request与upstream...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg33133.html">Re: [I] [Documentation] 快速入门(Docker):real request与upstream...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg33134.html">Re: [I] [Documentation] 快速入门(Docker):real request与upstream...</a></span> <span class="sender italic">via GitHub</span></li> <li class="icons-email"><span class="subject"><a href="msg33150.html">Re: [I] [Documentation] 快速入门(Docker):real request与upstream...</a></span> <span class="sender italic">via GitHub</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="[I] [BUG] <title>快速入门(Docker):real request与upstreamUrl的示例配置易使新手因网络上下文混淆而连接失败 [shenyu]"> <input type="hidden" name="msgid" value="I_kwDOCGCHjs611WBm@gitbox.apache.org"> <input type="hidden" name="relpath" value="notifications@shenyu.apache.org/msg33109.html"> <input type="submit" value=" via GitHub "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="notifications@shenyu.apache.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search notifications"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/notifications@shenyu.apache.org/">notifications - all messages</a></li> <li class="icons-about"><a href="/notifications@shenyu.apache.org/info.html">notifications - about the list</a></li> <li class="icons-expand"><a href="/search?l=notifications@shenyu.apache.org&q=subject:%22%5C%5BI%5C%5D+%5C%5BBUG%5C%5D+%3Ctitle%3E%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8%5C%28Docker%5C%29%EF%BC%9Areal+request%E4%B8%8EupstreamUrl%E7%9A%84%E7%A4%BA%E4%BE%8B%E9%85%8D%E7%BD%AE%E6%98%93%E4%BD%BF%E6%96%B0%E6%89%8B%E5%9B%A0%E7%BD%91%E7%BB%9C%E4%B8%8A%E4%B8%8B%E6%96%87%E6%B7%B7%E6%B7%86%E8%80%8C%E8%BF%9E%E6%8E%A5%E5%A4%B1%E8%B4%A5+%5C%5Bshenyu%5C%5D%22&o=newest&f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg33106.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg33130.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">I_kwDOCGCHjs611WBm@gitbox.apache.org</li> </ul> </div> </body> </html>