When I use the "Attach to Running Container…" feature of VS Code I have to manually install the few extensions that I need installed in the container.
Is there a way to setup VS Code such that when I attach to a running container it automatically installs the extensions I need?
I am aware of this question: Automatically install extensions in VS Code?
But that doesn’t say anything about installing extensions in running containers automatically and isn’t clear on how the answers could be used to accomplish this.
The specific extension I need installed is the Python extension from Microsoft. I’m not sure that is relevant, but just in case it is.
2
Answers
From a similar question on Github:
Not sure when this feature was added, but in VSCode, open your project in the remote container as normal, then under the extensions side-tab, find the extension you want and click the "cog" settings icon. It has the open to "Add to devcontainer.json".
This command will add that extension to the
customizations.vscode.extensions
setting in thedevcontainer.json
file.