-
Notifications
You must be signed in to change notification settings - Fork 39
DOC-404: Document orphaned containers after Docker Compose stop #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -154,6 +154,30 @@ For example, a container which attempts to deploy a stack and interact with the | |||||
|
|
||||||
| Refer to our [network troubleshooting guide](/aws/customization/networking/) covering several scenarios. | ||||||
|
|
||||||
| ### Why are some containers left behind after I stop LocalStack with Docker Compose? | ||||||
|
|
||||||
| When LocalStack shuts down, it cleans up the auxiliary containers it started for services such as Lambda, ECS, RDS or EKS. If it is stopped before that cleanup finishes, those containers are left running. | ||||||
|
|
||||||
| By default, LocalStack gets only a few seconds. Docker Compose sends `SIGTERM` to the container and follows up with `SIGKILL` once `stop_grace_period` expires (10 seconds by default), and LocalStack stops waiting for its own cleanup after `SHUTDOWN_TIMEOUT` (5 seconds by default). Whichever window runs out first, LocalStack is stopped mid-cleanup and the containers survive as orphans. Cleanup that takes longer than a few seconds is the most likely to be cut short. | ||||||
|
|
||||||
| To give LocalStack enough time to shut down cleanly, raise `stop_grace_period` on the LocalStack service in your `docker-compose.yml` (for example, `3m`): | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```yaml | ||||||
| services: | ||||||
| localstack: | ||||||
| image: localstack/localstack-pro:latest | ||||||
| stop_grace_period: 3m | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also, writing this period as seconds makes it more obviously match the number below. |
||||||
| environment: | ||||||
| - SHUTDOWN_TIMEOUT=180 | ||||||
| # ... | ||||||
|
quetzalliwrites marked this conversation as resolved.
|
||||||
| ``` | ||||||
|
|
||||||
|
quetzalliwrites marked this conversation as resolved.
|
||||||
| Raise them together. If you raise only `stop_grace_period`, LocalStack still gives up on its cleanup after 5 seconds and the container then stays up until the grace period runs out, so every docker compose stop waits the full three minutes. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| If a previous run already left containers behind, run docker ps and remove the ones LocalStack started before starting it again. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| This applies to Docker Compose specifically. Starting LocalStack with `lstk` is not affected, as `lstk` waits for LocalStack to finish shutting down. | ||||||
|
|
||||||
| ### How to resolve the pull rate limit issue for LocalStack's Docker image? | ||||||
|
|
||||||
| If you receive `ERROR: toomanyrequests: Too Many Requests.` when pulling the LocalStack Docker image, you have reached your pull rate limit. | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.