Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: Summary step fails with "Cannot iterate over null" when image has no Cmd

オープン 初心者向け
#102 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
docker, dockerfile
領域
ci-cd, devops

調査の方向性

docker inspect を実行し、Config.Cmd を読み取る jq 式を使っているサマリースクリプトから始めます。inspect.json と失敗している式 join(\" \") は issue で特定されています。Config.Cmd や、場合によっては Config.Entrypoint を含む null の配列フィールドをサマリーが許容するようにし、その後、CMD なしで ENTRYPOINT を持つイメージが正常に完了することを確認します。

索引モデルが issue の本文から書いたものです。

説明

bug

Describe the Bug

The post-build summary step fails with exit code 5 when the built Docker image has a null Config.Cmd (i.e. the image uses only an ENTRYPOINT and no CMD instruction). The image builds and pushes successfully — the failure is entirely in the summary/reporting step, but it causes the whole job to be marked as failed.

Expected Behavior

The summary step should handle a null Config.Cmd gracefully and complete without error. Images that define only an ENTRYPOINT are valid Docker images and should not cause the action to fail.

Steps to Reproduce

  1. Use cloudposse/github-action-docker-build-push@v3 with summary: true (the default)
  2. Build a Docker image whose Dockerfile defines ENTRYPOINT but no CMD
  3. Observe the workflow fail in the summary step after an otherwise successful build and push

Screenshots

Logs from the failing step:

jq: error (at inspect.json:83): Cannot iterate over null (null)
Process completed with exit code 5.

The summary step runs docker inspect on the built image and extracts fields with jq. The line responsible is:

CMD=$(jq -r '.[0].Config.Cmd | join(" ")' inspect.json)

When Config.Cmd is null, jq cannot apply join to a null value and exits with code 5.

The suggested fix is a // [] fallback:

CMD=$(jq -r '.[0].Config.Cmd // [] | join(" ")' inspect.json)

The same pattern should be applied to any other field in the summary script that assumes a non-null array (e.g. Config.Entrypoint).

Environment

  • Action: cloudposse/github-action-docker-build-push@v3
  • Runner OS: ubuntu-latest
  • Docker image: defines ENTRYPOINT only, no CMD

Additional Context

The image inspect output confirms "Cmd": null in Config. This is valid per the Docker image spec — CMD is optional when ENTRYPOINT is set.

主要言語
Dockerfile
スター
14
フォーク
15
平均マージ
8時間 45分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudposse/github-action-docker-build-push のほかの issue

cloudposse/github-action-docker-build-push の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。