'Is there a way to launch Visual Studio Code and force it to open in a Remote Container?

I regularly open Visual Studio Code via code . and then have to click the Re-open in Container button.

Am I missing any shortcut to force it to do this from the command line?



Solution 1:[1]

You can open devcontainer directly with devcontainer CLI.

Install devcontainer CLI by running Remote-Containers: Install devcontainer CLI from VS Code. Then just run:

devcontainer open

in the same directory where you'd run code . and you will skip the Re-open step.

Solution 2:[2]

There is a way to do this GUIcally in Windows. I suspect this will also work for SSH / WSL workspaces.

  1. Open your dev container in VSCode as usual.
  2. Right-click on your VSCode taskbar icon; it should show you a jump list with MRU workspaces.
  3. Look for that [Dev Container] list item (mine shows localhost:2375 because that's my docker host). You might like to pin it.
  4. You can open directly into the dev container by clicking on that item.

enter image description here

Solution 3:[3]

I have done this with ApiLogicServer - you build the .devcontainer file, plus the Dockerfile

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bh213
Solution 2 FSCKur
Solution 3 val