fix: align ContainerInfo fields with inspect format template#10
Closed
juandiii wants to merge 0 commit into
Closed
fix: align ContainerInfo fields with inspect format template#10juandiii wants to merge 0 commit into
juandiii wants to merge 0 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
floci starttreated a running container as stopped and then failed trying to remove it:The root cause was a field-mapping bug in
inspectContainer. Thedocker inspectformat template emitted a duplicate{{.State.Status}}, producing 6 fields while the data only had 5. Every field after the image was off by one, sostatusended up mapped to the ports slot. As a resultstate()returned the wrong value, never matched"running", and the start flow attempted todocker rma live container.Separately, the command used
docker inspect(no subcommand), which falls back to images when no container matches. With an image namedflocipresent, the template rendered against the image and failed at{{.Name}}:template parsing error: executing "" at <.Name>: map has no entry for key "Name"Fix
docker container inspectNo such containerinstead of rendering against an image{{.State.Status}}id,name,image,status,portsContainerInfoconstructorparts[0..4];status→parts[3],ports→parts[4]Optional.empty()Verification
mvn test).inspectContainerreturns the correctstatusfor running, stopped, and missing containers.