如何在VSCode中配置开发容器的备用存储库配置文件夹?

huangapple go评论61阅读模式
英文:

How do I configure dev containers alternative repository configuration folders in VSCode?

问题

I am new to dev containers and their use in VSCode. 我是新手对于在VSCode中使用开发容器。

I have tried to follow the very minimal docs here, for Alternative: Repository configuration folders but it does not work and I can't figure out how to set it up so it is able to find the devcontainer file. 我尝试按照这里的非常简洁的文档,关于替代:存储库配置文件夹进行操作,但它不起作用,我无法弄清楚如何设置它以便能够找到devcontainer文件。

Can anyone provide more guidance on how to configure the "dev.containers.repositoryConfigurationPaths" setting or at least how to troubleshoot it, please? 有人可以提供更多关于如何配置"dev.containers.repositoryConfigurationPaths"设置或至少如何进行故障排除的指导吗,请?

If you have your own working example of using that configuration option, can you share it? 如果您有使用该配置选项的工作示例,能分享一下吗?

My dir structure is as follows: 我的目录结构如下:

The "my_project.code-workspace" file points to "src/my_project" directory where code from "git@github.com:MyOrg/my_project.git" is checked out. "my_project.code-workspace"文件指向"src/my_project"目录,其中包含来自"git@github.com:MyOrg/my_project.git"的代码。

How do I configure "dev.containers.repositoryConfigurationPaths" to find and use the "devcontainer.json" file? 我如何配置"dev.containers.repositoryConfigurationPaths"以找到并使用"devcontainer.json"文件?

Thanks in advance. 提前致谢。

英文:

I am new to dev containers and their use in VSCode. I have tried to follow the very minimal docs here, for Alternative: Repository configuration folders but it does not work and I can't figure out how to set it up so it is able to find the devcontainer file.

Can anyone provide more guidance on how to configure the "dev.containers.repositoryConfigurationPaths" setting or at least how to troubleshoot it, please?
If you have your own working example of using that configuration option, can you share it?

My dir structure is as follows:

projects
├── my_project.code-workspace
├── repo-containers
│   └── github.com
│       └── MyOrg
│           └── my_project
│               ├── Dockerfile
│               └── devcontainer.json
└── src
    └── my_project

The my_project.code-workspace file points to src/my_project directory where code from git@github.com:MyOrg/my_project.git is checked out.

my_project.code-workspace contents:

{
	"folders": [
		{
			"path": "src/my_project"
		}
	],
	"settings": {}
}

How do I configure dev.containers.repositoryConfigurationPaths to find and use the devcontainer.json file?

Thanks in advance.

答案1

得分: 0

以下是已翻译的内容:

该功能仅在容器中打开文件夹时有效。在容器中打开VSCode工作区时无效。

此外,我一直在使用工作区相对路径。路径应该是文件系统上的绝对路径(完整路径,而不是相对路径)。

我曾尝试从Linux/WSL机器上的远程VSCode会话中打开容器环境。这并不起作用。我猜可能是因为涉及了太多的层次和功能太复杂。我认为无法从远程机器环境中启动容器环境并具有自定义的repositoryConfigurationPaths设置。

希望对你有所帮助。

请参见:https://github.com/orgs/devcontainers/discussions/51

英文:

The feature works when opening a folder in a container only. It does not work when opening a VSCode workspace in a container.

Also I had kept using workspace relative path. The path should be an absolute path on the filesystem (full path, not relative)

I had tried opening the container environment from a remote VSCode session on a Linux/WSL machine too. It does not work. Possibly that is too many layers of indirection and too much of an inception going on for the feature to work I guess. A container env can not be started from a remote machine env and have a custom repositoryConfigurationPaths setting.

HTH

See: https://github.com/orgs/devcontainers/discussions/51

huangapple
  • 本文由 发表于 2023年5月26日 15:27:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76338546.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定