Skip to content

Fix image load response parsing in the docker manager - #96

Merged
alshabib merged 1 commit into
openconfig:masterfrom
f-sommerauer:containerz-image-load
Nov 5, 2026
Merged

alshabib merged 1 commit into
openconfig:masterfrom
f-sommerauer:containerz-image-load

Conversation

@f-sommerauer

Copy link
Copy Markdown
Collaborator

ImagePush decoded only the first message of the docker ImageLoad response
and used its stream text as the image reference. When an image with the
same name:tag already exists, docker first sends "The image X already
exists, renaming the old one with ID ... to empty string" and only then
"Loaded image: X", so the warning was passed to ImageTag and the push
failed with "Error parsing reference". Without a target name the
reference was split with strings.SplitN and parts[1] was read unchecked,
which panics when the stream has no ':' (empty stream, or
"Loaded image ID: ..." for untagged images).

  • Read all messages of the response and use the first "Loaded image: "
    (or "Loaded image ID: ") line; ignore other messages.
  • Return errors reported in the stream (errorDetail / error) as Internal.
  • Return Internal if no loaded image is reported instead of panicking.
  • Untagged images ("Loaded image ID: "): tag the ID when a target name
    is given, otherwise return InvalidArgument.
  • Split name and tag at the last ':' that is not part of a registry
    host:port; default the tag to "latest".

ImagePush decoded only the first message of the docker ImageLoad response
and used its stream text as the image reference. When an image with the
same name:tag already exists, docker first sends "The image X already
exists, renaming the old one with ID ... to empty string" and only then
"Loaded image: X", so the warning was passed to ImageTag and the push
failed with "Error parsing reference". Without a target name the
reference was split with strings.SplitN and parts[1] was read unchecked,
which panics when the stream has no ':' (empty stream, or
"Loaded image ID: ..." for untagged images).

- Read all messages of the response and use the first "Loaded image: "
  (or "Loaded image ID: ") line; ignore other messages.
- Return errors reported in the stream (errorDetail / error) as Internal.
- Return Internal if no loaded image is reported instead of panicking.
- Untagged images ("Loaded image ID: <id>"): tag the ID when a target name
  is given, otherwise return InvalidArgument.
- Split name and tag at the last ':' that is not part of a registry
  host:port; default the tag to "latest".
@f-sommerauer
f-sommerauer marked this pull request as ready for review November 5, 2026 17:13
@f-sommerauer
f-sommerauer requested a review from alshabib November 5, 2026 17:43
@alshabib
alshabib merged commit ae47d91 into openconfig:master Nov 5, 2026
6 checks passed
@f-sommerauer
f-sommerauer deleted the containerz-image-load branch November 6, 2026 09:36
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.

2 participants