使用JetBrains Gateway时,如何将端口从Gitpod-container转发到本地机器?

发布于 2025-01-25 05:17:06 字数 146 浏览 2 评论 0原文

我使用GitPod和Jetbrains Gateway来开发我的应用程序。我在Gitpod-container内的Docker容器中运行一个应用程序。带有应用程序的容器曝光端口以处理HTTP请求。 是否可以使用JetBrains Gateway将此端口转发到我本地机器中的端口?

I use GitPod and JetBrains Gateway to develop my application. I run an application in a docker container inside GitPod-container. The container with application expose ports to handle HTTP requests.
Is it possible to forward this port to port in my local machine using JetBrains Gateway?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春风十里 2025-02-01 05:17:06

您是否考虑过以下方法?

假设一个docker容器曝光8080,在.gitpod.yml中,您将拥有类似的东西:

tasks:
  - name: docker
    openMode: split-left
    command: docker build -t hello-world . && docker run -p 8080:80 hello-world
  1. 现在,将端口公开,再次从您的.gitpod.yml
ports:
  - port: 8080
    onOpen: open-browser
    visibility: public
  1. 一旦喷气式桥打开,转到集成的终端然后运行:
gp url 8080

将向您提供工作空间的远程URL,公开端口8080。URL看起来像:https:///8080-xh.ws-eu444xl .gitpod.io

仅供参考,如果您觉得这很有用,也可以选择通过SSH连接到工作区。您可以在工作区跑步态页面中的“更多操作”按钮中找到SSH连接片段,或者在探索活动工作空间列表时(单击三个点)。

如果有帮助,我创建了一个样本回购来测试以下测试: https://github.com /andreafalzetti/gitpod-示例c

如果您想端口并打开http:// localhost:{port} 在本地,我认为这是Jetbrains Gateway当前不支持的。

Did you consider the following approach?

Assuming a docker container exposing 8080, in .gitpod.yml you would have something like:

tasks:
  - name: docker
    openMode: split-left
    command: docker build -t hello-world . && docker run -p 8080:80 hello-world
  1. Now, expose the port, again from your .gitpod.yml:
ports:
  - port: 8080
    onOpen: open-browser
    visibility: public
  1. Once the JetBrains IDE opens, go to the integrated terminal and run:
gp url 8080

You will be presented with the remote URL for the workspace, exposing the port 8080. The URL will look like: https://8080-****.ws-eu44xl.gitpod.io.

FYI, there is also an option to Connect via SSH to the workspace, if you find that useful. You find the SSH connection snippet, in the "More Actions" button in the workspace running-status page or when you explore the list of active workspaces (click on the three dots).

If it helps, I've created a sample repo to test this: https://github.com/andreafalzetti/gitpod-experiments-c

If you want to port-forward and open http://localhost:{PORT} locally, I think that is currently not supported by JetBrains Gateway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文