diff options
author | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2023-03-07 09:07:25 +0000 |
---|---|---|
committer | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2023-03-07 09:07:25 +0000 |
commit | 4e795c423f5129b212ed909407828b9fbc696f86 (patch) | |
tree | f3e285dfc90e254e9c32179707c4fbe8fca44437 /tools/local-env/scripts/start.js | |
parent | a7ec28812c5564890844e7cea81c162b63752021 (diff) | |
download | wordpress-4e795c423f5129b212ed909407828b9fbc696f86.tar.gz wordpress-4e795c423f5129b212ed909407828b9fbc696f86.zip |
Build/Test Tools: Check if the Docker is available when running `npm run env:start`.
This aims to display a more helpful error message if the Docker service is not running.
Follow-up to [45783], [45819].
Props mkox, cnspecialcolor, pento, hasanuzzamanshamim, bgoewert, robinwpdeveloper, costdev, mukesh27.
Fixes #51898.
git-svn-id: https://develop.svn.wordpress.org/trunk@55473 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tools/local-env/scripts/start.js')
-rw-r--r-- | tools/local-env/scripts/start.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index 35edf7f96f..df27a67a62 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -4,6 +4,17 @@ const { execSync } = require( 'child_process' ); dotenvExpand.expand( dotenv.config() ); +// Check if the Docker service is running. +try { + execSync( 'docker info' ); +} catch ( e ) { + if ( e.message.startsWith( 'Command failed: docker info' ) ) { + throw new Error( 'Could not retrieve Docker system info. Is the Docker service running?' ); + } + + throw e; +} + // Start the local-env containers. const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) ? 'wordpress-develop memcached' |