メインコンテンツへスキップ
kitlocal.dev

Docker & Composeチートシート

ローカルで実行

100% ブラウザ内で処理されます。入力や出力が端末の外に送信されることはありません。

Docker 27+ におけるコンテナライフサイクル、イメージビルド、マルチステージ Dockerfile、Compose v2 スタック、ネットワーク、ボリューム、ログ、安全なクリーンアップコマンド。

動作の仕組み

Images are immutable layered templates; containers are writable runtime processes from an image; volumes persist state across container replacement; networks wire service DNS.

サバイバルキット

最初に覚えるべき最小限のコマンド。

42 件のコマンド

キーボードショートカット/検索にフォーカスJK選択を移動C選択項目をコピーF選択項目をブックマークEsc検索をクリア

Run & Inspect Containers

Start containers, map ports, inspect logs, and attach interactive shells.

  • 基本

    Start an ephemeral interactive container and delete it on exit

    docker run --rm -it <image> <shell>

    コマンドを組み立てる

    docker run --rm -it <image> <shell>

    値は入力した通りにそのまま挿入されます。空白や特殊文字を含む場合は、必要に応じて引用符で囲んでください。

    使いどころ

    Best for throwaway debugging environments without leaving stopped containers behind.

    コマンドの内訳

    --rm
    Automatically remove container once it exits
    -it
    Interactive stdin (-i) + pseudo-TTY (-t)

    実例

    docker run --rm -it alpine:3.20 sh

Images & Multi-Platform Builds

Build, tag, inspect image layers, and manage local registries.

Docker Compose v2

Orchestrate multi-container local stacks cleanly with `docker compose`.

Volumes, Networks & Files

Persist database state, connect containers by service name, and copy files.

Disk Usage & Safe Cleanup

Measure disk consumption and prune unused objects without losing data.

KitLocalツールで試す

2026/11/15 に検証済み · Docker Engine CLI 27+ & Compose v2 で検証済み

出典: Docker CLI Reference · Docker Compose CLI Reference

山括弧内の内容は実際の値に置き換えてください。コマンドは公式ドキュメントに基づいており、実例は記載されたバージョンで実行確認されています。