LoginSignup
4
6

More than 1 year has passed since last update.

VScodeからSSH経由でDocker Containerにアクセスしてみた

Posted at

はじめに

何番煎じかも分からないが,VScodeのRemote containerを使ってみたのでメモ.
※VScodeでRemote-SSHを使えている人向けに書きます.

できること

  • ローカルPC -> SSH -> サーバ -> Docker Container のように,リモートのDocker Containerへの接続
  • リモートのcontainer内のファイルをVScodeで直接開ける
  • Dockerの基本操作がGUIからできる(多分)

環境

  • 【ローカル】: VScodeにRemote-SSHがインストール済み
  • VScode -> Remote間でSSHの公開鍵は設定済み
    • つまり,パスワードなしでSSH接続できる状態で,
    • VScodeのRemote-SSHでサーバに接続してファイルの編集ができる

手順

  1. VScodeの「拡張機能」タブから,Remote-Containersをインストールする
    image.png

  2. Ctrl+Shift+p -> connect to host でSSH経由でリモートに入る
    image.png

  3. Ctrl+Shift+p -> attach to running container でContainerに入る
    image.png

まとめ

リモート上のDockerに直接接続できるのはうれしすぎる.
いよいよ全部VScodeで開発が完結できそうな気がしてきた.

4
6
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
6