wO_o
wO_o

Reputation: 318

Visual Studio Code Remote - Containers: change default root directory

I am using Remote-Containers extension on VSCode to work directly on my running containers. The project hierarchy of my container looks like this:

angular_container
    /usr/
        src/
            app/
                frontend/
                    my-source-files

I right-click my container and select the 'Attach Visual Studio Code' option. By default, this opens the /usr/src/app/src/ directory on my container, which doesn't exist. Is there a way to change this setting so that VSCode opens the /usr/src/app/ directory instead? The Remote - Containers extension settings does not specify anything like this.

Upvotes: 9

Views: 7951

Answers (1)

osk386
osk386

Reputation: 514

Maybe, you selected it by default but you can change it:

Open the command list: Shift + Ctrl + P

Search for this command and select it: Remote-Containers: Open attached container configuration file

Select your container from the list, this will open your configuration.

Something like this:

{
    "workspaceFolder": "/root",
    "extensions": [
        "ms-python.python",
        "ms-toolsai.jupyter"
    ]
}

Change the workspaceFolder with your desired.

Save and re attach the container.

Upvotes: 22

Related Questions