Net Core Docker Server Shutdown Timeout Configuration: 'server.shutdownTimeoutSec'
The 'server.shutdownTimeoutSec' property controls how long a Net Core server running in a Docker container waits for connections to close before shutting down. This configuration option helps ensure a graceful shutdown process, preventing abrupt connection drops.
You can set this property in two ways:
- Dockerfile: Include the property in your Dockerfile to configure the server behavior during build time. For example:
FROM myimage
ENV server.shutdownTimeoutSec=30
- Command Line: Specify the property when starting a Docker container using the
-eflag. For example:
docker run -e server.shutdownTimeoutSec=30 myimage
This command starts a container using the 'myimage' image, setting the 'server.shutdownTimeoutSec' property to 30 seconds. This means the server will wait up to 30 seconds for all connections to close before shutting down. If connections remain active after 30 seconds, the server will force them closed and then shut down.
原文地址: https://www.cveoy.top/t/topic/nCEr 著作权归作者所有。请勿转载和采集!