4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCode Remote Containerをコマンドラインから直接開くことができるようになったのでやってみた

Posted at

VSCodeのRemote-Containers extensionでContainerをコマンドラインから直接開くことができるようになりました。
これまではVSCodeを起動した後にContainerを開く必要があり手間に感じていたため、試してみました。

準備

devcontainer cliをインストールする必要があります。
私はWSL2(Debian)で実施しましたが、Macでも同様の手順になると思います。

  1. Remote-Containers extensionv0.188.0以降がインストールされていることを確認します。

  2. F1を押下してコマンドパレットを開き、Remote-Containers: Install devcontainer CLIを選択します。
    image.png

  3. AddでPASSを追加します。
    image.png

  4. OKを押して、メッセージに従ってシェルを再起動します。
    image.png

  5. devcontainer cliがインストールされていることを確認します。

    $ devcontainer --help
    devcontainer <command>
    
    Commands:
      devcontainer open [path]             Open a dev container in VS Code
      devcontainer build [path] [options]  Build a dev container image
    
    Options:
      -h, --help  Show help  [boolean]
    
  6. 準備は以上です。

動作確認

openコマンドでContainerを直接開くことができました✨
なお、Containerの設定ファイルがあるディレクトリに移動するか、引数のpathを指定する必要があります。

$ devcontainer open
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?