Skip to content

fix: use SIGKILL and StopCommand in lifecycle example#212

Merged
joshrotenberg merged 1 commit intomainfrom
fix/lifecycle-example-stop
Jan 5, 2026
Merged

fix: use SIGKILL and StopCommand in lifecycle example#212
joshrotenberg merged 1 commit intomainfrom
fix/lifecycle-example-stop

Conversation

@joshrotenberg
Copy link
Copy Markdown
Owner

Summary

Fixes the lifecycle_commands example which was failing on Windows (and potentially other systems) because:

  1. KillCommand with SIGTERM doesn't guarantee immediate container termination
  2. The 1 second sleep wasn't enough for the container to fully stop
  3. RmCommand without --force fails on running containers

Changes

  • Use SIGKILL instead of SIGTERM for the kill demo (immediate termination)
  • Added a second section demonstrating the proper stop -> rm pattern
  • Print the stopped container names from StopResult instead of discarding the result

Testing

Verified the example runs successfully:

cargo run --example lifecycle_commands

Fixes #201

- SIGKILL immediately terminates container, allowing rm without force
- Added second demo showing proper stop -> rm pattern
- Print stopped container names from StopResult

Fixes #201
@joshrotenberg joshrotenberg force-pushed the fix/lifecycle-example-stop branch from eebdff4 to 956abe6 Compare January 5, 2026 21:19
@joshrotenberg joshrotenberg merged commit 02538cd into main Jan 5, 2026
11 checks passed
@joshrotenberg joshrotenberg deleted the fix/lifecycle-example-stop branch January 5, 2026 21:31
@github-actions github-actions Bot mentioned this pull request Jan 5, 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.

cannot remove container \"lifecycle-example\": container is running: stop the container before removing or force remove

1 participant