Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
実践VSCodeリモートSSH・コンテナ開発機能
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
74th(Atsushi Morimoto)
January 23, 2020
Technology
2.1k
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
310
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
4
25k
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
10
8.8k
書いた同人誌をMCP Server化したら 趣味の組み込み開発が捗った話
74th
1
220
VS Code Update for GitHub Copilot
74th
3
1.2k
技術同人誌をMCP Serverにしてみた
74th
1
1.1k
AIをプロダクトに実装するならAPIで分離しよう 〜タクシーアプリ『GO』のアーキテクチャ実例紹介〜
74th
3
880
最近のVS Codeで気になるニュース 2025/01
74th
1
440
VS CodeでF1〜12キーつかってますか? / Do you use the F1-12 keys in VS Code?
74th
2
690
Other Decks in Technology
See All in Technology
re:Invent の去年のスケジュールを公開します!
miu_crescent
PRO
0
150
Systems Manager AgentがインストールされたPCを紛失した時の対策を考えてみた
amarelo_n24
1
110
デザインレビューは自動化できるのか?─ Flutter × Figma で UI 品質保証を考える
techiro
2
720
素人でもできた!AIを使った短編小説創作入門
delhi09
PRO
0
280
ドメインエキスパートは いかにして AI を使って プロダクト開発をするか
tatsuyashiraishi
1
250
AI時代、つくる力を自分たちの手に。 ──電通×KAG、アジャイルとAI駆動開発で挑む開発の変革
yuukiyo
3
450
"計画的無茶振り"を通してAIネイティブ世代の新人を育てる
subroh0508
1
140
AI時代のエンジニアの情報発信〜個人の発信を組織の力に変える〜
ryo_kawamata
0
6.5k
生き様としてのSRE
hokkai7go
1
150
1週間、Opus封印でお願いします
kintotechdev
1
430
攻撃 3 時間 vs 復旧 10 時間。アクセスキー流出の非対称性を体感するために CTF を作った話
kazzpapa3
1
130
視野はAIに、視座は人に / ai-for-breadth-humans-for-perspective
nkzn
6
2.7k
Featured
See All Featured
How to make the Groovebox
asonas
2
2.5k
Navigating Weather and Climate Data
rabernat
0
570
Making Projects Easy
brettharned
120
6.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
380
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
310
Balancing Empowerment & Direction
lara
6
1.4k
Deep Space Network (abreviated)
tonyrice
0
400
WENDY [Excerpt]
tessaabrams
14
40k
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