Docker(2/2)
トラブルシュートと本番差分。
ホスト CLI の使い方
早見表
| CLI | 主用途 | インストール(macOS 例) | 認証・動作確認 | エージェントがよく使う例 |
|---|---|---|---|---|
gh |
PR / Issue / CI 状況 | brew install gh |
gh auth status |
gh pr checks · gh run view |
vercel |
preview deploy · env pull |
npm i -g vercel |
vercel whoami |
vercel link · vercel env pull .env.local |
aws |
ECS / ECR / S3 / ログ | brew install awscli |
aws sts get-caller-identity |
aws logs tail · aws ecr describe-repositories |
supabase |
ローカル DB · migration | brew install supabase/tap/supabase |
supabase projects list |
supabase start · supabase db push |
docker |
compose 起動 | Docker Desktop | docker compose version |
docker compose up -d · docker compose exec app … |
危険操作の扱い
vercel deploy --prod や本番 aws 変更は、エージェントが勝手に実行しないよう 強制確認ルール と 完了前の検証 を rules に書く。
CLI 別の初手
GitHub CLI (gh)
- インストールと確認
brew install gh gh --version - ログイン — ブラウザまたはトークン。
gh auth login後にgh auth statusでLogged inを確認する。 - リポジトリ紐付け — 作業ディレクトリで
gh repo set-default(またはgh repo viewで remote 確認)。 - エージェントの初手 — PR 調査:
gh pr checks→ 失敗 run:gh run view RUN_ID --log-failed。 - つまずき — SSO 組織は
gh auth login --hostname github.com --webを再実行。トークン scope 不足はrepo/read:orgを付与。
Vercel CLI
- インストールと確認
npm install -g vercel vercel --version - ログイン —
vercel login(ブラウザ)→vercel whoami。 - プロジェクト紐付け — 初回
vercel link。環境変数はvercel env pull .env.local(.env.localは gitignore)。 - エージェントの初手 — preview:
vercel(対話)または CI 経由。ローカル確認前にvercel env pullで不足キーを潰す。 - つまずき — 複数 team/scope があるときは
vercel switch。本番 deploy は要確認(上記「危険操作」)。
AWS CLI
- インストールと確認
brew install awscli aws --version - 認証(SSO 推奨)
aws configure sso --profile myapp-dev aws sso login --profile myapp-dev export AWS_PROFILE=myapp-dev aws sts get-caller-identity開発のみ IAM ユーザーの場合は
aws configure --profile myapp-dev。本番 CI は OIDC(11.5 CI/CD)を正本とする。 - プロファイル確認 —
aws configure list-profiles。複数アカウントではAWS_PROFILEを rules に明記する。 - エージェントの初手 — ログ:
aws logs tail /ecs/myapp --follow。イメージ:aws ecr describe-repositories。 - つまずき — SSO セッションは数時間で切れる。
aws sso loginを再実行。region 未設定はAWS_DEFAULT_REGION=ap-northeast-1等を profile に固定。
Supabase CLI(短文)
brew install supabase/tap/supabase→supabase login→supabase projects list- ローカル:
supabase init→supabase start(Docker 必須。詳細は 11.3) - マイグレーション:
supabase db push/supabase migration new
Docker / Compose(短文)
- ホストに Docker Desktop(または Linux engine)を入れ、
docker compose versionが通る状態にする - アプリ・DB・テストは 11.3 ローカル開発 の
make up/docker compose execを正本とする - エージェントへの指示は「ホストで compose 起動、実行は exec 経由」と rules で固定する