Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions php/EE/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,25 @@ public function check_requirements( $show_error = true ) {
$status = true;
$error = [];

$docker_running_cmd = 'docker ps > /dev/null';
if ( ! EE::exec( $docker_running_cmd ) ) {
$status = false;
$docker_running = false;
$error[] = 'Docker not installed or not running.';
// Retry logic for Docker availability check to handle transient failures under system load.
$docker_running_cmd = 'docker ps > /dev/null 2>&1';
$max_retries = 4;

for ( $attempt = 1; $attempt <= $max_retries; $attempt++ ) {
if ( EE::exec( $docker_running_cmd ) ) {
break; // Docker is available, exit retry loop.
}

if ( $attempt < $max_retries ) {
$retry_delay = pow( 2, $attempt - 1 ); // Exponential backoff: 1s, 2s, 4s
EE::debug( "Docker check failed (attempt {$attempt}/{$max_retries}), retrying in {$retry_delay}s...", 'bootstrap' );
sleep( $retry_delay );
} else {
// All retries exhausted.
$status = false;
$docker_running = false;
$error[] = "Docker not installed or not running (checked {$max_retries} times).";
}
}

$docker_compose_installed = 'command -v docker-compose > /dev/null';
Expand Down Expand Up @@ -749,17 +763,17 @@ private function set_alias( $alias ) {

public function start() {

EE::debug( $this->_global_config_path_debug, 'bootstrap' );
EE::debug( $this->_project_config_path_debug, 'bootstrap' );
EE::debug( 'argv: ' . implode( ' ', $GLOBALS['argv'] ), 'bootstrap' );

$this->init_ee();

// Enable PHP error reporting to stderr if testing.
if ( getenv( 'BEHAT_RUN' ) ) {
$this->enable_error_reporting();
}

EE::debug( $this->_global_config_path_debug, 'bootstrap' );
EE::debug( $this->_project_config_path_debug, 'bootstrap' );
EE::debug( 'argv: ' . implode( ' ', $GLOBALS['argv'] ), 'bootstrap' );

if ( $this->alias ) {
if ( '@all' === $this->alias && ! isset( $this->aliases['@all'] ) ) {
EE::error( "Cannot use '@all' when no aliases are registered." );
Expand Down