Skip to content

fix: align ContainerInfo fields with inspect format template#11

Merged
hectorvent merged 1 commit into
floci-io:mainfrom
juandiii:main
Jun 30, 2026
Merged

fix: align ContainerInfo fields with inspect format template#11
hectorvent merged 1 commit into
floci-io:mainfrom
juandiii:main

Conversation

@juandiii

Copy link
Copy Markdown
Contributor

Problem

floci start treated a running container as stopped and then failed trying to remove it:

cannot remove container ... as it is running - running or paused containers cannot be removed without force

The root cause was a field-mapping bug in inspectContainer. The docker inspect format template emitted a duplicate {{.State.Status}}, producing 6 fields while the data only had 5. Every field after the image was off by one, so status ended up mapped to the ports slot. As a result state() returned the wrong value, never matched "running", and the start flow attempted to docker rm a live container.

Separately, the command used docker inspect (no subcommand), which falls back to images when no container matches. With an image named floci present, the template rendered against the image and failed at {{.Name}}:

template parsing error: executing "" at <.Name>: map has no entry for key "Name"

Fix

Change Detail
Use docker container inspect Prevents fallback to images; a missing container yields No such container instead of rendering against an image
Remove duplicate {{.State.Status}} Template now emits 5 fields: id, name, image, state, ports
Align ContainerInfo constructor Reads parts[0..4]; stateparts[3], portsparts[4]
Map "no such container" to Optional.empty() A missing container is absence, not an error

Verification

  • All unit tests pass (mvn test).
  • inspectContainer returns the correct state for running, stopped, and missing containers.

@hectorvent
hectorvent merged commit 0300251 into floci-io:main Jun 30, 2026
2 checks passed
hectorvent added a commit that referenced this pull request Jul 7, 2026
…elf-update (#14)

* docs: add AGENTS.md, CONTRIBUTING.md, PR template; document GCP and self-update

- AGENTS.md (tracked): canonical agent guidance — architecture incl. the
  three product trees table, doctor check structure per tree, native-image
  constraints, code style rules, updated scope rules (self-update now in
  scope, must never auto-run)
- CONTRIBUTING.md: build/test setup, Conventional Commits, hand-maintained
  Keep-a-Changelog policy, PR guidelines, tag-driven release process
- .github/pull_request_template.md: adapted from the server repo with a
  'product trees affected' checklist
- README: document the floci gcp command group (quick start, command
  reference, global flags, gcp env variables, CI usage), floci update,
  Java 25+ fat-JAR requirement; drop the unwired snapshot --message flag
  from examples
- CHANGELOG: backfill [Unreleased] with #12 (self-update) and #11
  (ContainerInfo field alignment); document these docs changes
- release.yml: release notes said the fat JAR needs Java 21+, but it is
  built with --release 25 — corrected to Java 25+

* docs(changelog): use standard Keep a Changelog headings for Unreleased

The Documentation section is not one of the six types defined by Keep a
Changelog 1.1.0. New docs (AGENTS.md, CONTRIBUTING.md, README GCP section)
move under Added; the incorrect Java 21+ runtime claim moves under Fixed.
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