Skip to content

Fix KeyError crash with Docker 29.x due to absent image config fields#255

Closed
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-issue-253
Closed

Fix KeyError crash with Docker 29.x due to absent image config fields#255
Copilot wants to merge 3 commits into
masterfrom
copilot/fix-issue-253

Conversation

Copilot AI commented Mar 30, 2026

Copy link
Copy Markdown

Docker 29.x changed docker image inspect to omit empty/nil fields (Entrypoint, Cmd, Env, User, WorkingDir) instead of returning them as null, causing gsc build to crash with a KeyError on images that lack an explicit entrypoint.

Changes

  • gsc.py: Replace direct config['key'] access with config.get('key') for all five affected fields across extract_binary_info_from_image_config, extract_environment_from_image_config, and extract_user_from_image_config
# Before — KeyError on Docker 29.x when field is absent
entrypoint = config['Entrypoint'] or []
cmd = config['Cmd'] or []

# After — treats absent field same as null
entrypoint = config.get('Entrypoint') or []
cmd = config.get('Cmd') or []
  • test/test_image_config.py: 20 unit tests covering both the Docker 28.x (field present, null value) and Docker 29.x (field absent) behaviors for all three affected functions

This change is Reviewable

Copilot AI changed the title [WIP] Review and suggest fix for issue 253 Fix KeyError crash with Docker 29.x due to absent image config fields Mar 30, 2026
Copilot AI requested a review from donporter March 30, 2026 19:50
@donporter donporter marked this pull request as ready for review March 30, 2026 20:00
@mtomczew

Copy link
Copy Markdown

I can confirm this fixes issue I reported in #253

@kailun-qin kailun-qin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kailun-qin reviewed 1 file and made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion, not enough approvals from maintainers (2 more required), not enough approvals from different teams (2 more required, approved so far: ) (waiting on copilot[bot] and donporter).


a discussion (no related file):
Closing in favor of #244.

@kailun-qin kailun-qin closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants