11

Within VSCode there is an extention Remote - Containers with option to save the installed extensions to a file name devcontainer.json. This allows VSCode to install the necessary extensions when you are using a container-based environment.

However, this is not working. When I select the following option, no file is created. Or if I create the file it is not updated.

Add to container.json option

My VSCode setup is: * Win10 * VSCode 1.44.2 * This is being performed via the WSL2 remote connection.

Many Thanks,

12
  • 4
    I don't understand if this should be a docker or a vscode related question. How are you working with docker and vscode? What is the container about you spun up? Can you post more information like the Dockerfile or the devcontainer.json? Which extension you are talking about? What are you doing in vscode to receive your goal? Best Commented Apr 11, 2020 at 14:52
  • Your question needs more details for someone to understand what exactly you want to achieve and what you have done till now Commented May 10, 2020 at 7:21
  • But the question contains that (?) Commented May 10, 2020 at 7:47
  • @felix001, your question is not clear, can you provide more details, e.g Dockerfile and how is VSCode is related to the container, what this container running? Commented May 10, 2020 at 7:52
  • 1
    @felix001, few things are not clear. What container are you attaching to? Also you said However, when I select add to devcontainer.json from the extensions panel, In extension panel I don't see any such option, if you can few screenshots and a bit more details it will help solve the issue Commented May 10, 2020 at 14:14

1 Answer 1

1

Indeed Remote - Containers fails to put extensions' ids into devcontainer.json... unless you create the .devcontainer/devcontainer.json AND unless you put there some content:

{
  "extensions": []
}

should be enough.
Actually, even

{
}

is enough.

Sign up to request clarification or add additional context in comments.

8 Comments

seems to work for a standard connection aka it doesnt work when using the WSL remote connection (?)
Are you trying to modify devcontainer.json inside container or even from inside container?
Nope just when I’m in WSL is the WSL connection
I don't really understand your setup. Where is your workspace and how it is shared among Windows, WSL and a container? You're obviously using Remote Containers AND Remote WSL at the same time. Why? I don't have Windows, but I'm under impression that to work with a container you need only Remote Containers extension. With both extensions running you have at least 3 places where you need to place devcontainer.json with some content in it (or share):
the local workspace, the WSL filesystem, the container filesystem. Also Remote Containers need to be installed at least twice - locally (it will update devcontainer.json in a local workspace), in WSL (to update devcontainer.json in WSL), and maybe even in a container to (to update devcontainer.json in there). That looks really complicated.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.