diff --git a/compose.yaml b/compose.yaml index 039a3209..3c8a33b3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,7 @@ services: nextcloud-aio-mastercontainer: image: nextcloud/all-in-one:latest + init: true restart: always container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly volumes: diff --git a/develop.md b/develop.md index 8c3cef9d..7ac2bdec 100644 --- a/develop.md +++ b/develop.md @@ -2,6 +2,7 @@ If you want to switch to the develop channel, you simply stop and delete the mastercontainer and create a new one with a changed tag to develop: ```shell sudo docker run \ +--init \ --sig-proxy=false \ --name nextcloud-aio-mastercontainer \ --restart always \ diff --git a/php/containers-schema.json b/php/containers-schema.json index 91d32dc4..5bb7b6db 100644 --- a/php/containers-schema.json +++ b/php/containers-schema.json @@ -137,6 +137,9 @@ "read_only": { "type": "boolean" }, + "init": { + "type": "boolean" + }, "tmpfs": { "type": "array", "items": { diff --git a/php/containers.json b/php/containers.json index 1ca7fa86..be6aa1a8 100644 --- a/php/containers.json +++ b/php/containers.json @@ -11,6 +11,7 @@ ], "display_name": "Apache", "image": "nextcloud/aio-apache", + "init": true, "ports": [ { "ip_binding": "%APACHE_IP_BINDING%", @@ -69,6 +70,7 @@ "container_name": "nextcloud-aio-database", "display_name": "Database", "image": "nextcloud/aio-postgresql", + "init": true, "expose": [ "5432" ], @@ -122,6 +124,7 @@ ], "display_name": "Nextcloud", "image": "nextcloud/aio-nextcloud", + "init": true, "expose": [ "9000" ], @@ -218,6 +221,7 @@ "container_name": "nextcloud-aio-notify-push", "display_name": "Notify Push", "image": "nextcloud/aio-notify-push", + "init": true, "expose": [ "7867" ], @@ -253,6 +257,7 @@ "container_name": "nextcloud-aio-redis", "display_name": "Redis", "image": "nextcloud/aio-redis", + "init": true, "expose": [ "6379" ], @@ -283,6 +288,7 @@ "container_name": "nextcloud-aio-collabora", "display_name": "Collabora", "image": "nextcloud/aio-collabora", + "init": true, "expose": [ "9980" ], @@ -311,6 +317,7 @@ "container_name": "nextcloud-aio-talk", "display_name": "Talk", "image": "nextcloud/aio-talk", + "init": true, "ports": [ { "ip_binding": "", @@ -361,6 +368,7 @@ "container_name": "nextcloud-aio-talk-recording", "display_name": "Talk Recording", "image": "nextcloud/aio-talk-recording", + "init": true, "expose": [ "1234" ], @@ -392,6 +400,7 @@ { "container_name": "nextcloud-aio-borgbackup", "image": "nextcloud/aio-borgbackup", + "init": true, "environment": [ "BORG_PASSWORD=%BORGBACKUP_PASSWORD%", "BORG_MODE=%BORGBACKUP_MODE%", @@ -453,6 +462,7 @@ { "container_name": "nextcloud-aio-watchtower", "image": "nextcloud/aio-watchtower", + "init": true, "environment": [ "CONTAINER_TO_UPDATE=nextcloud-aio-mastercontainer" ], @@ -468,6 +478,7 @@ { "container_name": "nextcloud-aio-domaincheck", "image": "nextcloud/aio-domaincheck", + "init": true, "ports": [ { "ip_binding": "%APACHE_IP_BINDING%", @@ -494,6 +505,7 @@ "container_name": "nextcloud-aio-clamav", "display_name": "ClamAV", "image": "nextcloud/aio-clamav", + "init": true, "expose": [ "3310" ], @@ -527,6 +539,7 @@ "container_name": "nextcloud-aio-onlyoffice", "display_name": "OnlyOffice", "image": "nextcloud/aio-onlyoffice", + "init": true, "expose": [ "80" ], @@ -559,6 +572,7 @@ "container_name": "nextcloud-aio-imaginary", "display_name": "Imaginary", "image": "nextcloud/aio-imaginary", + "init": true, "expose": [ "9000" ], @@ -585,6 +599,7 @@ "container_name": "nextcloud-aio-fulltextsearch", "display_name": "Fulltextsearch", "image": "nextcloud/aio-fulltextsearch", + "init": false, "expose": [ "9200" ], diff --git a/php/src/Container/Container.php b/php/src/Container/Container.php index 1782211a..a7296a65 100644 --- a/php/src/Container/Container.php +++ b/php/src/Container/Container.php @@ -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; } diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 6deb308d..6641aff4 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -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) ); } diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index ef2a972b..6e5239ae 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -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; diff --git a/readme.md b/readme.md index da2aa3d1..7b2c0eeb 100644 --- a/readme.md +++ b/readme.md @@ -87,6 +87,7 @@ The following instructions are meant for installations without a web server or r ``` # For Linux and without a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) already in place: sudo docker run \ + --init \ --sig-proxy=false \ --name nextcloud-aio-mastercontainer \ --restart always \ @@ -101,6 +102,7 @@ The following instructions are meant for installations without a web server or r Explanation of the command - `sudo docker run` This command spins up a new docker container. Docker commands can optionally be used without `sudo` if the user is added to the docker group (this is not the same as docker rootless, see FAQ below). + - `--init` This option makes sure that no zombie-processes are created, ever. See https://docs.docker.com/engine/reference/run/#specify-an-init-process - `--sig-proxy=false` This option allows to exit the container shell that gets attached automatically when using `docker run` by using `[CTRL] + [C]` without shutting down the container. - `--name nextcloud-aio-mastercontainer` This is the name of the container. This line is not allowed to be changed, since mastercontainer updates would fail. - `--restart always` This is the "restart policy". `always` means that the container should always get started with the Docker daemon. See the Docker documentation for further detail about restart policies: https://docs.docker.com/config/containers/start-containers-automatically/ @@ -157,6 +159,7 @@ On Windows, install [Docker Desktop](https://www.docker.com/products/docker-desk ``` docker run ^ +--init ^ --sig-proxy=false ^ --name nextcloud-aio-mastercontainer ^ --restart always ^ diff --git a/reverse-proxy.md b/reverse-proxy.md index 0ce3f263..b4a1c8f0 100644 --- a/reverse-proxy.md +++ b/reverse-proxy.md @@ -604,6 +604,7 @@ After adjusting your reverse proxy config, use the following command to start AI ``` # For Linux: sudo docker run \ +--init \ --sig-proxy=false \ --name nextcloud-aio-mastercontainer \ --restart always \ @@ -629,6 +630,7 @@ On Windows, install [Docker Desktop](https://www.docker.com/products/docker-desk ``` docker run ^ +--init ^ --sig-proxy=false ^ --name nextcloud-aio-mastercontainer ^ --restart always ^