Skip to content

Commit cf935c9

Browse files
scuba: Default _get_image_config() to return None if Config key is missing
Docker Engine 28.2 changed the output of 'docker inspect --type image' to no longer include keys when their values are 'null'. This could cause get_image_command() and get_image_entrypoint() to raise an exception if the Cmd or Entrypoint keys are missing, respectively. Change from [] to .get() to return None if the key is missing, restoring the previous behavior. Fixes #262
1 parent 429ec47 commit cf935c9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
6+
### Fixed
7+
- Fixed regression with Docker Enginer 28.2 (#269)
8+
69
### Removed
710
- Dropped support for Python 3.7 (#242)
811

scuba/dockerutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_images() -> Sequence[str]:
113113
def _get_image_config(image: str, key: str) -> Optional[Sequence[str]]:
114114
info = docker_inspect_or_pull(image)
115115
try:
116-
result = info["Config"][key]
116+
result = info["Config"].get(key)
117117
except KeyError as ke:
118118
raise DockerError(f"Failed to inspect image: JSON result missing key {ke}")
119119

0 commit comments

Comments
 (0)