Search code examples
visual-studio-codevscode-remotevscode-devcontainerdevcontainer

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


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 [email protected]: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.


Solution

  • 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