Merge pull request #750 from Squidly271/docker_timeout

Add customizable timeout when stopping containers
This commit is contained in:
tom mortensen
2020-09-27 14:06:14 -07:00
committed by GitHub
3 changed files with 12 additions and 2 deletions

View File

@@ -145,6 +145,11 @@ _(Enable Docker)_:
:docker_enable_help:
_(Docker Stop Timeout)_:
: <input id="DOCKER_TIMEOUT" type="number" name="DOCKER_TIMEOUT" min='1' value="<?=$dockercfg['DOCKER_TIMEOUT']?>">
:docker_timeout_help:
<?if ($DockerStopped):?>
_(Docker data-root)_:

View File

@@ -5,4 +5,5 @@ DOCKER_LOG_SIZE="50m"
DOCKER_LOG_FILES="1"
DOCKER_AUTHORING_MODE="no"
DOCKER_USER_NETWORKS="remove"
DOCKER_ALLOW_ACCESS=""
DOCKER_ALLOW_ACCESS=""
DOCKER_TIMEOUT=10

View File

@@ -747,7 +747,11 @@ class DockerClient {
return $code;
}
public function stopContainer($id, $t=10) {
public function stopContainer($id, $t=false) {
global $dockercfg;
if ( ! $t )
$t = intval($dockercfg['DOCKER_TIMEOUT']) ?: 10;
$this->getDockerJSON("/containers/$id/stop?t=$t", 'POST', $code);
$this->flushCache($this::$containersCache);
return $code;