fix: mariadb startup with latest image

This commit is contained in:
Soner Sayakci
2023-12-13 16:12:54 +00:00
parent 622a3ad355
commit 95de1b5e24
2 changed files with 366 additions and 500 deletions
Generated
+358 -499
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -12,7 +12,14 @@ class MariaDBContainer extends Container
{ {
parent::__construct('mariadb:' . $version); parent::__construct('mariadb:' . $version);
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword); $this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
$this->withWait(new WaitForExec(['mysqladmin', 'ping', '-h', '127.0.0.1']));
$binary = 'mysqladmin';
if ($version === 'latest' || version_compare($version, '11.0.0', '>')) {
$binary = 'mariadb-admin';
}
$this->withWait(new WaitForExec([$binary, 'ping', '-h', '127.0.0.1']));
} }
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self