add init flag to all containers

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-08-10 16:41:47 +02:00
parent 1b1626fe56
commit 4c0e30d49d
9 changed files with 39 additions and 0 deletions

View file

@ -32,6 +32,7 @@ class Container {
private array $nextcloudExecCommands;
private bool $readOnlyRootFs;
private array $tmpfs;
private bool $init;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -54,6 +55,7 @@ class Container {
array $nextcloudExecCommands,
bool $readOnlyRootFs,
array $tmpfs,
bool $init,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -75,6 +77,7 @@ class Container {
$this->nextcloudExecCommands = $nextcloudExecCommands;
$this->readOnlyRootFs = $readOnlyRootFs;
$this->tmpfs = $tmpfs;
$this->init = $init;
$this->dockerActionManager = $dockerActionManager;
}
@ -98,6 +101,10 @@ class Container {
return $this->readOnlyRootFs;
}
public function GetInit() : bool {
return $this->init;
}
public function GetShmSize() : int {
return $this->shmSize;
}

View file

@ -272,6 +272,11 @@ class ContainerDefinitionFetcher
$tmpfs = $entry['tmpfs'];
}
$init = true;
if (isset($entry['init'])) {
$init = $entry['init'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -292,6 +297,7 @@ class ContainerDefinitionFetcher
$nextcloudExecCommands,
$readOnlyRootFs,
$tmpfs,
$init,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -450,6 +450,8 @@ class DockerActionManager
$requestBody['HostConfig']['Tmpfs'] = $tmpfs;
}
$requestBody['HostConfig']['Init'] = $container->GetInit();
$capAdds = $container->GetCapAdds();
if (count($capAdds) > 0) {
$requestBody['HostConfig']['CapAdd'] = $capAdds;