Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#102 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
docker, dockerfile
Ambito
ci-cd, devops

Direzione di ricerca

Inizia dallo script di riepilogo che esegue docker inspect e dall’espressione jq che legge Config.Cmd; inspect.json e l’espressione non riuscita join(\" \") sono identificati nell’issue. Fai in modo che il riepilogo tolleri i campi array null, inclusi Config.Cmd ed eventualmente Config.Entrypoint, quindi verifica che un’immagine con ENTRYPOINT ma senza CMD venga completata correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Dockerfile
Stelle
14
Fork
15
Merge medio
8h 45m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudposse/github-action-docker-build-push

Tutte le issue di cloudposse/github-action-docker-build-push

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.