Make WordPress Core

#56550 closed defect (bug) (fixed)

Failure to run env:start on Linux due to invalid docker-compose argument

Reported by: westonruter's profile westonruter Owned by: westonruter's profile westonruter
Milestone: 6.1 Priority: normal
Severity: normal Version: 6.1
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:


This is a follow-up to #55700.

In [53895] the docker-compose command was modified as follows:

  • trunk/tools/local-env/scripts/start.js

    a b  
    1111// Start the local-env containers.
    12 execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
     12const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
     13    ? 'wordpress-develop memcached'
     14    : 'wordpress-develop';
     15execSync( `docker-compose up -d -- ${containers}`, { stdio: 'inherit' } );
    1417// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.

The inclusion of -- before the list of containers is causing the env:start command to fail on Linux, at least in docker-compose v1.25.0. I get an error:

$ npm run env:start

> WordPress@6.1.0 env:start /home/westonruter/repos/wordpress-develop
> node ./tools/local-env/scripts/start.js

Creating network "wordpress-develop_wpdevnet" with driver "bridge"
ERROR: No such service: --
    throw err;

Error: Command failed: docker-compose up -d -- wordpress-develop
    at checkExecSyncError (child_process.js:790:11)
    at execSync (child_process.js:863:15)
    at Object.<anonymous> (/home/westonruter/repos/wordpress-develop/tools/local-env/scripts/start.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 8626,
  stdout: null,
  stderr: null
npm ERR! errno 1
npm ERR! WordPress@6.1.0 env:start: `node ./tools/local-env/scripts/start.js`
npm ERR! Exit status 1

If I remove the -- then the command runs successfully.

Attachments (1)

56550.0.diff (672 bytes) - added by westonruter 18 months ago.

Download all attachments as: .zip

Change History (8)

#1 @westonruter
18 months ago

  • Keywords has-patch added

#2 @westonruter
18 months ago

  • Summary changed from Failure to run env:start on Linux due to invalid docker-compose arguments to Failure to run env:start on Linux due to invalid docker-compose argument

#3 @saggre
17 months ago

Also happens to me with docker-compose version 1.25.0 from focal/universe

This ticket was mentioned in PR #3291 on WordPress/wordpress-develop by Saggre.

17 months ago

Docker-compose interprets end of options (--) as a service name when running local tools start script.

The hyphens are unnecessary here.


Trac ticket:

#5 @saggre
17 months ago

Oh sorry you already had a diff @westonruter

#6 @westonruter
17 months ago

  • Keywords commit added
  • Owner set to westonruter
  • Status changed from new to accepted

The same patch fixes the issue for at least two users. So I move to commit this.

#7 @westonruter
17 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54350:

Build/Test Tools: Remove extraneous -- from docker-compose up command.

This end of command options mark can be erreonously interpreted as an (invalid) container name.

Props westonruter, saggre
Fixes #56550

Note: See TracTickets for help on using tickets.