公式リファレンスを見ても分かりづらいのでメモ. Docker Compose経由でビルドされたデフォルトイメージ名は {プロジェクト名}_{サービス名} となる (デフォルトプロジェクト名はディレクトリ名だが, コマンドラインオプション -p から指定可能). 例えば以下のような構成であれば, イメージ名が hoge_fuga, コンテナ名が piyo となる. hoge ┣ Dockerfile ┣ docker-compose.yml ┗ ... # docker-compose.yml version: '2' services: fuga: build: . container_name: piyo しばしば長ったらしいイメージ名になってしまう. そこで以下のように image を追加することでイメージ名を指定できる. image と build が同時に宣言されている場合は, ビ