Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch VSCode into devcontainer session

It appears that the only way to run devcontainers locally is by following these steps:

  1. Open your codebase in VSCode
  2. Reopen VSCode / The application in a devcontainer via command or the "Reopen in Container" popup

I would like to skip step 1 and launch VSCode directly into a container session. Is this currently possible?

like image 448
BitPatty Avatar asked Dec 21 '25 20:12

BitPatty


2 Answers

According to this Issue you can call the code command with according arguments, e.g. from your project folder (on a Mac)

p=$(echo -n "$PWD"|xxd -p -c 256) && code --folder-uri "vscode-remote://dev-container+${p/[[:space:]]/}/workspace"

(where /workspace ist the remote workspace folder)

For more information see the issue.

like image 125
thlcodes Avatar answered Dec 24 '25 00:12

thlcodes


This is now officially supported in the devcontainer CLI.

After installing the CLI, the project can be opened directly in a devcontainer using the command:

devcontainer open .
like image 43
BitPatty Avatar answered Dec 24 '25 00:12

BitPatty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!