Hastarin
Hastarin

Reputation: 375

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?

Upvotes: 17

Views: 4603

Answers (3)

bh213
bh213

Reputation: 6519

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.

Upvotes: 7

val
val

Reputation: 159

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

Upvotes: 0

FSCKur
FSCKur

Reputation: 1050

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

Upvotes: 2

Related Questions