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
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
270
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
4
25k
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
10
8.5k
書いた同人誌をMCP Server化したら 趣味の組み込み開発が捗った話
74th
1
210
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
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
4.3k
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
25
16k
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
110
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
110
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
840
え、こんなに早く改修できるの?──新人エンジニアとスクラムマスターの2人が語る、AI×アジャイル開発の現場
ysasago
0
150
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
330
What the customer really needed
kawaguti
PRO
3
200
絵ではじめるKubernetesセキュリティ
aoi1
3
640
事業課題から技術的負債に向き合う
sansantech
PRO
2
1.9k
空間オーディオで過去の 自分(ゴースト)と競うランニング 〜HealthKitのルートを足音に変える実装〜
nao_randd
0
220
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
41k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Designing Powerful Visuals for Engaging Learning
tmiket
1
550
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
550
Design in an AI World
tapps
1
320
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
940
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Become a Pro
speakerdeck
PRO
31
6.3k
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