October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

Docker Compose Down Timeout: Why Containers Stop Slowly and How to Fix It

Docker Compose normally sends SIGTERM, waits 10 seconds, then sends SIGKILL. This guide explains slow shutdowns, PID 1 signal handling, stop_grace_period, stop_signal, diagnostics, and safe timeout fixes.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If docker compose down appears to pause for about ten seconds, Docker is usually waiting for a container to shut down gracefully. Compose asks the container’s main process to exit with SIGTERM, waits through the configured grace period, and then uses SIGKILL if the process is still running. The reliable fix is to make the application receive and handle the signal correctly; increasing the timeout is appropriate only when legitimate cleanup needs more time.

What docker compose down actually does

docker compose down tears down the active Compose project. It stops the project’s containers, removes those containers, and removes the project networks. Additional options can request removal of associated volumes or images, so read the command you are about to run carefully if persistent data matters.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The --timeout (or -t) option changes how long Compose waits during shutdown. It applies to that command invocation; it is not a repair for an application that ignores termination signals. A command such as docker compose down --timeout 30 gives the containers 30 seconds to finish their normal stop path before Docker forcefully ends any process that remains.

The normal shutdown timeline

Compose delegates container stopping to Docker. The sequence is deterministic:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  1. Compose identifies the containers belonging to the project and requests a stop.
  2. Docker sends SIGTERM to the container’s main process (PID 1), unless the service defines another stop_signal.
  3. Docker waits for the container’s stop grace period. The documented default is 10 seconds.
  4. If the process has not exited when that period expires, Docker sends SIGKILL. The process cannot catch or defer this signal.
  5. After the containers stop, Compose removes the project containers and networks, plus any other resources requested by the command’s flags.

“The docker compose stop command attempts to stop a container by sending a SIGTERM. It then waits for a default timeout of 10 seconds. After the timeout, a SIGKILL is sent to the container to forcefully kill it.”

That ten-second wait is therefore not an arbitrary Compose pause. It is the opportunity for the application to close connections, flush data, finish in-flight work, and exit on its own. A teardown that consistently reaches the timeout boundary indicates either a slow but intentional cleanup path or a signal-delivery problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why a container reaches the timeout

A shell is PID 1 instead of the application

The most common documented cause is a shell-form command in the image. When an image starts through a shell, the shell can become PID 1 while the real application runs as its child. Docker sends SIGTERM to PID 1. If that shell does not forward the signal, the application never sees the request to shut down and remains alive until Docker sends SIGKILL.

Prefer the exec form in the Dockerfile so the application is the container’s main process. For a Node application, the pattern is:

CMD ["node", "server.js"]

This arrangement makes the application process PID 1 and gives it a direct opportunity to handle SIGTERM. Replacing a shell wrapper with exec form does not by itself guarantee clean shutdown if the application has no handler, but it removes the signal-forwarding failure at the container boundary.

The application does not handle SIGTERM

Receiving a signal and knowing what to do with it are separate concerns. An application can be PID 1 and still continue running because it has no termination handler, waits indefinitely for a worker, or treats SIGTERM as an ordinary ignored signal. In that case, Compose waits through the grace period and Docker eventually uses SIGKILL.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A graceful handler should stop accepting new work, let safe in-flight work finish, close network and database connections, flush pending writes, stop child workers, and then exit. The handler must also have a bounded path: a cleanup routine that can wait forever is functionally the same as no handler when the timeout expires.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

The image expects a different signal

Compose uses SIGTERM unless the service’s stop_signal is configured. Some software documents another signal for an orderly shutdown. If the image expects that signal, set stop_signal to the documented value rather than assuming the default is correct. Do not change the signal speculatively: use the application’s own shutdown documentation or observed behavior to choose it.

Cleanup legitimately takes longer than ten seconds

Not every timeout means the container is broken. Databases may finish transactions, queues may drain work, and web servers may complete requests and close connections. A service can be functioning correctly while its normal shutdown exceeds the default grace period.

Compose lets you express that policy per service with stop_grace_period. It accepts a duration such as 30s or 1m30s. This setting documents the expected cleanup window and applies whenever that service is stopped, rather than only during one manual teardown.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find the service that consumes the delay

Measure before changing timeouts. A project with several services can appear to hang because one container is still running while the others have already stopped.

1. List the project containers

docker compose ps

Use the output to identify services that remain running or show an unhealthy state while teardown is in progress. Record the service name and the container name shown by Compose; you will need them for logs and inspection.

2. Read the service logs

docker compose logs SERVICE

Replace SERVICE with the Compose service name. Look for a shutdown message, a message that never appears, or a final operation that repeats. A log line announcing that the process received a termination request is evidence that the signal reached the application; silence can indicate a shell wrapper, a different process owning PID 1, or an application that does not log signal handling.

3. Inspect the container configuration

docker inspect CONTAINER

Replace CONTAINER with the container name or ID. Check the configured entrypoint and command, the image used by the service, and any stop-signal or timeout settings. Compare the actual command with the Dockerfile: a Compose override can reintroduce a shell even when the image itself uses exec form.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

4. Separate a slow stop from a removal problem

Observe when the delay occurs. If the pause happens before the container reports stopped, it is the signal and grace-period phase. If containers stop promptly but network or resource removal takes time, investigate the resource being removed instead of increasing the shutdown timeout. The --timeout option controls the container stop wait, not every operation performed after stopping.

Fix the signal path first

Use exec-form entrypoints

Change shell-form startup in the Dockerfile to an exec-form instruction, rebuild the image, and ensure Compose uses the rebuilt image. The important property is that the long-running application becomes PID 1. If a wrapper script is required for environment preparation, it should eventually replace itself with the application process rather than leaving the application as an uncooperative child.

After changing the image, recreate the service. A running container keeps its old process tree; editing a Dockerfile does not alter that container in place. Bring the project up with the rebuilt image, then repeat the teardown test.

Add bounded graceful-shutdown handling

Implement an explicit SIGTERM path in the application. The handler should coordinate workers and external connections, reject new requests, complete only work that can finish within the service’s grace period, and exit with a clear status. Ensure errors during cleanup do not leave the process waiting indefinitely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test the handler independently of Compose when possible. A process that exits cleanly after receiving SIGTERM will also give Compose a clean stop path, while a process that only stops after SIGKILL will continue to hit the timeout regardless of the Compose command used.

Set stop_signal only when the application requires it

If the application’s documentation specifies a signal other than SIGTERM, configure that signal on the service. The setting belongs with the service definition because it describes how that particular image shuts down. Keep the default when the application already handles SIGTERM; changing signals without a documented reason can make shutdown less predictable.

Configure a service-specific grace period

Use stop_grace_period when you have confirmed that the process is receiving the intended signal and is performing valid cleanup that takes longer than ten seconds. A Compose service can declare, for example:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
services:
  app:
    stop_grace_period: 30s

For a longer, measured operation, a value such as 1m30s is also valid. Choose the shortest period that covers the observed cleanup rather than adding a large cushion. A long grace period slows every teardown of that service, including emergency maintenance, and can conceal a regression if no one watches the logs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the policy close to the service that needs it. A database may need more time to flush state while a stateless front end may stop in well under a second. Giving the entire project a uniformly large timeout makes it harder to see which service actually needs special treatment.

Use a one-off timeout when the policy should not persist

For a single maintenance operation, increase the command timeout:

docker compose down --timeout 30

This gives the project’s containers 30 seconds for the stop phase during that invocation. It does not add signal handling, change PID 1, or repair an image whose process ignores SIGTERM. If the process is stuck, the longer wait merely postpones the eventual SIGKILL.

A command-level timeout is useful when cleanup is temporarily heavier than usual or when you are validating a service before committing a persistent Compose policy. Once the same duration is required on every stop, move the setting to the affected service’s stop_grace_period and keep the command timeout at its normal value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remedy comparison

Remedy Scope Signal correctness Cleanup duration Data-safety risk
Exec-form entrypoint Image and every container created from it Delivers SIGTERM directly to the application as PID 1 Does not add time; enables the application’s existing handler Reduces forced termination when the shell was blocking the signal
Application shutdown handler Application code Defines how the process responds to the received signal Allows bounded draining, flushing, and connection closure Can protect in-flight writes when implemented and tested correctly
stop_signal One Compose service Uses the signal documented by that application Leaves the grace-period length unchanged Safer than a mismatched default when the image requires another signal
stop_grace_period One Compose service, persistently Does not change which signal is sent Extends the service’s normal wait, such as 30s or 1m30s Reduces premature killing only when cleanup is known to be progressing
docker compose down --timeout 30 One teardown command Does not repair signal delivery Extends the current command’s wait to 30 seconds Can delay force-killing but still ends with SIGKILL if the process never exits
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to choose a safe timeout

Start with evidence from logs and inspection. If the application receives SIGTERM and logs a sequence of cleanup actions, measure the longest normal run of that sequence and add only a modest operational margin. If there is no progress, increasing the number is the wrong fix: correct the entrypoint, signal, or handler first.

  • Use the default when the service exits promptly and no data is at risk.
  • Use a longer service policy when the same, observable cleanup regularly exceeds ten seconds.
  • Use a one-off command timeout for an exceptional teardown while you investigate whether the behavior should become permanent.
  • Avoid indefinite waits. Every grace period should have a reason and a bounded cleanup path.

The key safety distinction is whether the process is making progress. A longer timeout protects a process that is flushing data or finishing requests. It does not protect a process that never received the signal, has deadlocked, or is waiting on a child that cannot exit.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Recreate and verify the change

  1. Update the Dockerfile, application shutdown code, or Compose service definition.
  2. Rebuild the image if the entrypoint or application code changed.
  3. Recreate the affected service so the new process tree and settings are actually applied.
  4. Run docker compose ps and confirm the expected service is present.
  5. Run docker compose logs SERVICE while stopping the project and watch for the termination and cleanup messages.
  6. Run docker compose down with the normal timeout, then check that the containers and project networks are removed as intended.

If the service still consumes exactly the grace-period boundary after the change, inspect the newly created container rather than the old one. Persistent timing at the boundary usually means the process is still not exiting, the wrong command is being launched, or the configured signal does not match the application.

Troubleshooting branches

The delay is always exactly ten seconds

An exact ten-second pattern strongly points to the default grace period expiring. Check whether PID 1 is a shell, whether the application logs a termination event, and whether the service overrides the stop signal. Fix those conditions before setting a larger number.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The delay varies and logs show cleanup work

Variable duration with visible progress is consistent with legitimate draining or flushing. Measure the slow cases, set a service-specific stop_grace_period that covers them, and keep monitoring so a new hang is not mistaken for normal cleanup.

The application exits, but down still appears stuck

Use docker compose ps to see whether another service is still running. Compose stops project containers individually; one slow dependency can hold up the overall command even when the application you were watching has already exited. Inspect logs and configuration for each remaining service.

Force-killing loses recent data

SIGKILL cannot be handled, so any writes or transactions still in progress can be interrupted. Treat repeated forced kills as an operational defect for stateful services. Implement bounded shutdown, make sure the signal reaches the real process, and set a grace period long enough for the verified cleanup sequence.

A timeout change had no effect

Confirm which mechanism you changed. docker compose down --timeout 30 affects one command. stop_grace_period affects the service definition used when containers are created. If the image or Compose command changed, recreate the service; existing containers retain their original process and configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bottom line

A slow Compose teardown is a symptom, not a single failure mode. Docker’s normal contract is to send SIGTERM, wait 10 seconds by default, and then send SIGKILL. First make the application PID 1 and give it a bounded graceful-shutdown handler. Then select the correct stop_signal if the image requires one, and declare a measured stop_grace_period for services whose valid cleanup exceeds the default. Reserve docker compose down --timeout for one-off timing changes, because a larger number cannot fix a process that never receives or acts on the shutdown signal.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.