diff --git a/php/containers-schema.json b/php/containers-schema.json index 538593fd..39ed0a51 100644 --- a/php/containers-schema.json +++ b/php/containers-schema.json @@ -73,6 +73,9 @@ "restart": { "type": "string" }, + "shm_size": { + "type": "integer" + }, "secrets": { "type": "array", "items": { diff --git a/php/containers.json b/php/containers.json index 5c3e02fd..f96be79e 100644 --- a/php/containers.json +++ b/php/containers.json @@ -74,7 +74,8 @@ "PGTZ=%TIMEZONE%" ], "stop_grace_period": 1800, - "restart": "unless-stopped" + "restart": "unless-stopped", + "shm_size": 268435456 }, { "container_name": "nextcloud-aio-nextcloud", diff --git a/php/src/Container/Container.php b/php/src/Container/Container.php index e30e8674..8d5e8ac5 100644 --- a/php/src/Container/Container.php +++ b/php/src/Container/Container.php @@ -25,6 +25,7 @@ class Container { private array $devices; /** @var string[] */ private array $capAdd; + private string $shmSize; private DockerActionManager $dockerActionManager; public function __construct( @@ -41,6 +42,7 @@ class Container { array $secrets, array $devices, array $capAdd, + string $shmSize, DockerActionManager $dockerActionManager ) { $this->identifier = $identifier; @@ -56,6 +58,7 @@ class Container { $this->secrets = $secrets; $this->devices = $devices; $this->capAdd = $capAdd; + $this->shmSize = $shmSize; $this->dockerActionManager = $dockerActionManager; } @@ -75,6 +78,10 @@ class Container { return $this->restartPolicy; } + public function GetShmSize() : string { + return $this->shmSize; + } + public function GetMaxShutdownTime() : int { return $this->maxShutdownTime; } diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index b903169e..95d87913 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -218,6 +218,11 @@ class ContainerDefinitionFetcher $capAdd = $entry['cap_add']; } + $shmSize = ''; + if (isset($entry['shm_size'])) { + $shmSize = $entry['shm_size']; + } + $containers[] = new Container( $entry['container_name'], $displayName, @@ -232,6 +237,7 @@ class ContainerDefinitionFetcher $secrets, $devices, $capAdd, + $shmSize, $this->container->get(DockerActionManager::class) ); } diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 3e5f7def..c6f3163c 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -411,6 +411,11 @@ class DockerActionManager $requestBody['HostConfig']['Devices'] = $devices; } + $shmSize = $container->GetShmSize(); + if ($shmSize !== '') { + $requestBody['HostConfig']['ShmSize'] = $shmSize; + } + $capAdds = $container->GetCapAdds(); if (count($capAdds) > 0) { $requestBody['HostConfig']['CapAdd'] = $capAdds;