Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
実践VSCodeリモートSSH・コンテナ開発機能
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
74th(Atsushi Morimoto)
January 23, 2020
Technology
2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
実践VSCodeリモートSSH・コンテナ開発機能
VSCode Meetup #2
https://vscode.connpass.com/event/160083/
74th(Atsushi Morimoto)
January 23, 2020
More Decks by 74th(Atsushi Morimoto)
See All by 74th(Atsushi Morimoto)
自作お家AIエージェントスタックチャンFWで困っている所紹介
74th
0
260
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
4
25k
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
10
8.5k
書いた同人誌をMCP Server化したら 趣味の組み込み開発が捗った話
74th
1
200
VS Code Update for GitHub Copilot
74th
3
1.1k
技術同人誌をMCP Serverにしてみた
74th
1
1k
AIをプロダクトに実装するならAPIで分離しよう 〜タクシーアプリ『GO』のアーキテクチャ実例紹介〜
74th
3
810
最近のVS Codeで気になるニュース 2025/01
74th
1
430
VS CodeでF1〜12キーつかってますか? / Do you use the F1-12 keys in VS Code?
74th
2
670
Other Decks in Technology
See All in Technology
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
380
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
2
620
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
120
KPIだけでは評価できないプロダクトが考えるべき Evalsという第二の評価系 / Beyond KPIs: Evals as a Second Evaluation Framework for Products #PdEConf
aki_iinuma
4
3.7k
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
180
Bet AI Day 2026丨バクラク Autopilot、業務システムの再設計
layerx
PRO
2
1.5k
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
240
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
440
Backstageでつくるセルフサービスな社内開発基盤
kikunosuke75
1
340
少人数データチームのDevin活用実践事例
runandy16
2
450
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
240
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
160
Featured
See All Featured
Building Adaptive Systems
keathley
44
3.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
230
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
400
Paper Plane
katiecoart
PRO
2
53k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
Joys of Absence: A Defence of Solitary Play
codingconduct
1
480
Transcript
実践 リモートSSH・コンテナ開発機能 Atsushi Morimoto @74th
Atsushi Morimoto @74th Python、Go、Kubernetes、Terraform @ VSCode with RemoteDev 仕事の開発の95%をリモート開発機能を使う(残り5%はAndroid) 様々な言語、環境のデバッグ設定集
https://github.com/74th/vscode-debug-specs
2月20日発売予定 400ページで、ほぼ全機能解説 TypeScript/Go/Pythonでの 実践的な開発実例 拡張機能開発 (コマンド、タスク、テーマ…) LSP解説 → LSPを使った拡張機能開発まで ※表紙は作成中のもので、変わることがあります
Contents 1. リモート開発機能でどう世界が変わったか 2. @74thの環境と、リモートSSH機能デモ 3. リモートSSHの制約 4. WSL 5.
リモートコンテナ機能とは 6. リモートコンテナ機能デモ 7. WSL、リモートSSHでリモートコンテナ機能を使う
近年のよくある開発環境
近年のよくある開発環境
リモート開発機能とは…
リモート開発機能の何が嬉しいか? A: 使い慣れたPC(MacOS、Windows)を使いながら、 Linuxの世界で開発ができる ◦ 最終成果物のLinuxコンテナで動けばOK! ◦ MacOS、Windowsでの環境構築不要! ◦ Linuxの解析ツールがすべて使える(systemtap、strace……)
@74th の環境 Host : MacOS+Parallels Desktop 15 • Apple Hypervisor
Frameworkに対応 • 比較した中で、IO性能が高かった VM: Ubuntu Server 19.10 • Homebrew がLinuxでも使える App: GoのWebアプリ • ~/go/src/github.com/74th/vscode-book-golang • TODO 管理アプリ MacBookPro
リモートSSH機能デモ • SSHログイン ◦ ~/.ssh/config/ ◦ Goの補完が効く様子 • デバッグ実行とポートフォワーディング
リモートSSH機能の制約 • Linuxサーバを構築していること(Windowsサーバは準備中)。 • x86_64 or aarch64 アーキテクチャであること。 • SSHで接続可能であること。~/.ssh/config
に設定があること。 • Linuxサーバ内で、プロジェクトファイルがチェックアウトされていること。 • Linuxサーバに、ビルドに必要なツールのほか、git、curlなども含めて、 開発に必要なソフトウェアがインストールされていること。 • Linuxサーバでリポジトリにアクセスできること。
ARM64 (Raspberry Pi 4) aarrch64(ARM64)に対応 拡張機能やLanguageServerが 対応していない場合もある
ARM64 (Raspberry Pi 4) aarrch64(ARM64)に対応 拡張機能やLanguageServerが 対応していない場合もある
WSL(Windows Subsystem for Linux) • 仮想マシンと異なり、 メモリ、CPU、ストレージの リソースはホストマシンと共有 • WSL
2からdockerも使える • $ code . で起動 • localhost を共有
リモートコンテナ機能での開発
Dockerfile • 本番環境のDockerfileとは別に作る • git、procpsを追加 • 本番環境と開発用のツールを 両方ともインストール • 変更したら
コマンド「Rebuild Container」 <Dockerfileの参考> https://github.com/Microsoft/vscode-remote-try-node try-{python,go,java,dotnetcore,php,rust,cpp} FROM python:3.7 RUN apt-get update && \ apt-get -y install git procps WORKDIR /app ADD ./requirements.txt ./ RUN pip install -r requirements.txt ADD ./dev-requirements.txt ./ RUN pip install -r dev-requirements.txt
.devcontainer/devcontainer.json • Dockerfile .devcontainer/からの相対パス • 拡張機能 • 開放ポート • 変更したら
コマンド「Rebuild Container」 { "name": "Python 3.7", "context": "..", "dockerFile": "Dockerfile", "appPort": [8080], "extensions": [ "ms-python.python" ] }
リモートコンテナ機能デモ • Reopen in Container
WSLのDockerを使いたい 昨日の Docker Desktopの アップデートで対応 ※Experimental
None
SSH先のDockerを使いたい 要するに DockerAPI にアクセスして、リポジトリをマウントする ◦ TCPでDockerにアクセス可能にする /etc/default/docker -> DOCKER_OPT=DOCKER_OPTS="-H 0.0.0.0:9000”
export DOCKER_HOST=tcp://remote:9000 ◦ WSL、SSH先でリポジトリをチェックアウトして、 そのディレクトリをマウントする docker-compose.yamlを作る ◦ docker-composeでコンテナを起動する ◦ コマンド「Attach to Running Container」→ コマンド「Open Folder...」でマウントしたディレクトリを開く • https://qiita.com/74th/items/06b91cf4fecfc61bfbf4
docker-compose.yaml https://qiita.com/74th/items/06b 91cf4fecfc61bfbf4 version: "3" services: python: build: context: .
dockerfile: ./Dockerfile ports: - 8080:8080 user: "1000:1000" # マウント先のユーザ environment: HOME: "/home/nnyn/" # .vscode-serverディレクトリに使われ る command: /bin/sh -c "while sleep 10000; do :; done" # コンテナを起動するだけで何もしない volumes: - /home/nnyn/vscode-book-python:/app # リポジトリマウント - /home/nnyn/.git:/home/nnyn/.git # gitの設定 - /home/nnyn/.netrc:/home/nnyn/.netrc # gitの認証情報 - /home/nnyn/.vscode-container:/home/nnyn/.vscode-server # 拡張機能を共有 SSH先の Dockerを使いたい
リモート開発機能の もう少し詳しい内容は… 技術書典7 BOOTHで販売中 https://74th.booth.pm/items/1575560