Add support to gracefully shutdown the server

This is done by draining the connections for configured time after registry receives a SIGTERM signal.
This adds a `draintimeout` setting under `HTTP`. Registry doesn't drain
if draintimeout is not provided.

Signed-off-by: Manish Tomar <manish.tomar@docker.com>
This commit is contained in:
Manish Tomar 2018-07-30 16:15:35 -07:00
parent 9bf62ca7b3
commit 40efb602d6
No known key found for this signature in database
GPG key ID: 9B5659469D1399D2
5 changed files with 113 additions and 7 deletions

View file

@ -84,6 +84,10 @@ type Configuration struct {
// Location headers
RelativeURLs bool `yaml:"relativeurls,omitempty"`
// Amount of time to wait for connection to drain before shutting down when registry
// receives a stop signal
DrainTimeout time.Duration `yaml:"draintimeout,omitempty"`
// TLS instructs the http server to listen with a TLS configuration.
// This only support simple tls configuration with a cert and key.
// Mostly, this is useful for testing situations or simple deployments