带有DevContainer的Clone Repo Inside Docker卷,重新打开并访问IP
首先麻烦是如何重新打开带有远程容器选项的卷中的克隆回购:
“命名容器卷中的克隆存储库”
它在容器中创建卷,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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于问题#1:您可以访问使用选项创建的容器
克隆存储库中的集装箱卷中的克隆存储库
以三种方式:open oble最近菜单:<代码> ctrl+shift+p &gt;
文件:从 file 菜单或 欢迎页面中的最近列表中打开
。再次克隆相同的存储库,因为它不会创建一个新的卷并使用现有的卷(请注意,如果您更改分支,VSCODE将克隆默认值,这将无效)。
来自远程资源管理器或 docker 面板:在容器列表中找到您的项目,然后
右键单击
&gt;开始
,然后附加docker的Visual Studio Code
或右键单击
&gt;在容器中打开文件夹
远程资源管理器。对于问题2:这取决于您要做什么。
如果您想从主机计算机访问容器的服务:从您指定的端口处的浏览器,从
localhost
中检查您的服务是否可以访问。如果不是这样,则必须您正在使用。请记住,您可以将容器的端口映射到主机的另一个端口,这可能会引起一些混乱。如果要从容器中访问主机计算机的服务(或可从中可以访问的另一个容器的服务):您必须将
host.docker.internal.internal
用作您的URL,如说明此处。如果要从另一个容器访问容器的服务,而无需将端口暴露于主机:您可以使用 docker-compose 并用作URL服务的名称。
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 thenAttach Visual Studio Code
for Docker orright 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.