带有DevContainer的Clone Repo Inside Docker卷,重新打开并访问IP

发布于 2025-02-10 05:55:27 字数 419 浏览 0 评论 0原文

首先麻烦是如何重新打开带有远程容器选项的卷中的克隆回购:

“命名容器卷中的克隆存储库”

它在容器中创建卷,i可以用它加重我想要的内部,但是如果我关闭此VScode窗口,我该如何返回此卷并继续工作?


第二我遇到的问题是此创建卷的IP。我克隆了一个可以通过其他应用程序访问的应用程序(我在本地运行了所有应用程序),但是当我尝试访问由Docker卷创建的应用程序时,它只是没有找到此IP并且很难连接。

我尝试了什么:访问“ Localhost”,访问本地计算机IP,访问Docker卷中“ IfConfig”提供的IP。


遵循的步骤: clone存储库中的命名容器卷> 尝试连接此卷中的克隆

First trouble is how to re-open a cloned repo inside a volume with Remote container's option:

"Clone repository in named container volume"

It creates the volume inside a container, i can use it exacly how i wanted inside it, but if i close this vscode window, how do i get back to this volume and continue working?


Second issue i'm having is with the ip for this created volume. I cloned an application that is accessible by other applications (i run all of them locally) but when i try to access the app created by the docker volume it just does'nt find this ip and have trouble connecting.

What have i tried: access "localhost", access the local machine ip, access the ip provided by "ifconfig" inside the docker volume.


Steps followed: Clone repository in named container volume > Try to connect the cloned inside this volume

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

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

发布评论

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

评论(1

蒗幽 2025-02-17 05:55:27

对于问题#1:您可以访问使用选项创建的容器克隆存储库中的集装箱卷中的克隆存储库以三种方式:

  • open oble最近菜单:<代码> ctrl+shift+p &gt; 文件:从 file 菜单或 欢迎页面中的最近列表中打开

  • 再次克隆相同的存储库,因为它不会创建一个新的卷并使用现有的卷(请注意,如果您更改分支,VSCODE将克隆默认值,这将无效)。

  • 来自远程资源管理器 docker 面板:在容器列表中找到您的项目,然后右键单击&gt; 开始,然后附加docker的Visual Studio Code右键单击&gt; 在容器中打开文件夹远程资源管理器。


对于问题2:这取决于您要做什么。

For question #1: you can access a container created with the option Clone Repository in Container Volume in three ways:

  • from the Open Recent menu: Ctrl+Shift+P > File: Open Recent, from the File menu or the Recent list in the welcome page.

  • cloning again the same repository, as it will not create a new volume and use the existing one (note, however, that if you change branch, vscode will clone the default one, which will not work).

  • from the Remote Explorer or Docker panel: find your project in the container list and then right click > Start and then Attach Visual Studio Code for Docker or right click > Open Folder in Container for the Remote Explorer.


For question #2: it depends on what you are trying to do.

  • If you want to access the services of the container from your host machine: check that your service is accessible from localhost, from your browser at the port you specified. If it is not, you have to forward the ports you are using. Keep in mind that you can map a port of the container to a different port of the host, this can cause some confusion.

  • If you want to access the services of your host machine (or of another container that is accessible from it) from the container: you must use host.docker.internal as your URL, as explained here.

  • If you want to access the services of a container from another container, without exposing the ports to the host: you can use docker-compose and use as URL the name of the service.

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