Skip to content

feat: add/support stop_grace_period - #150

Open
jpagh wants to merge 1 commit into
Mcrich23:mainfrom
jpagh:add-stop_grace_period
Open

feat: add/support stop_grace_period#150
jpagh wants to merge 1 commit into
Mcrich23:mainfrom
jpagh:add-stop_grace_period

Conversation

@jpagh

@jpagh jpagh commented Aug 30, 2026

Copy link
Copy Markdown

Summary

Adds support for Compose’s stop_grace_period service option.

Container Compose now:

  • Parses Compose duration values such as 30s, 1m30s, and fractional values
  • Uses Compose’s default 10-second timeout when omitted
  • Passes the configured timeout to Apple Container when:
    • Running container-compose down
    • Replacing existing containers during up
    • Stopping foreground containers with Ctrl+C
  • Preserves the image’s configured stop signal, falling back to SIGTERM
  • Rejects invalid or out-of-range durations

Example

  services:
    app:
      image: alpine:latest
      stop_grace_period: 75s

Testing

  • Added static tests covering:
    • Combined durations
    • Default timeout behavior
    • Fractional-second truncation
    • Invalid durations
    • Apple Container stop-option conversion
  • Added a dynamic test confirming that the configured deadline is enforced
  • Manually verified with a real container that traps SIGTERM, waits 70 seconds, and exits:
    • Configured stop_grace_period: 75s
    • container-compose down waited 71 seconds
    • The container completed its graceful shutdown instead of being killed after the default 10 seconds

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.

1 participant