multipass icon indicating copy to clipboard operation
multipass copied to clipboard

`docker-compose` alias does not behave the same as local `docker-compose`

Open ObliviousHarmony opened this issue 2 years ago • 0 comments

Describe the bug I was hoping to utilize Multipass' Docker preset with wp-env but have run into problems because a docker-compose alias doesn't behave the same way that a local docker-compose with the DOCKER_HOST environment variable set.

When I run the wp-env start command, internally, it runs child_process.spawn() on docker-compose. This bypasses the local shell and just passes the arguments directly to the target executable. When I run this using a docker:docker-compose alias, I get the following error:

bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `'cd' '/Users/obliviousharmony/Code/WordPress/gutenberg/packages/env'&&'docker-compose' '-f' '/Users/obliviousharmony/.wp-env/fcc19ccf5624bfb3d7f4b1258f0d4ea7/docker-compose.yml' 'run' '-T' 'tests-cli' 'bash' '-c' "set -eo pipefail && wp core install --url="localhost:8889" --title="env" --admin_user=admin --admin_password=password [email protected] --skip-email && wp config set WP_DEBUG false --anchor="define( 'WP_DEBUG'," --raw && wp config set SCRIPT_DEBUG false --anchor="define( 'WP_DEBUG'," --raw && wp config set WP_ENVIRONMENT_TYPE "local" --anchor="define( 'WP_DEBUG'," && wp config set WP_PHP_BINARY "php" --anchor="define( 'WP_DEBUG'," && wp config set WP_TESTS_EMAIL "[email protected]" --anchor="define( 'WP_DEBUG'," && wp config set WP_TESTS_TITLE "Test Blog" --anchor="define( 'WP_DEBUG'," && wp config set WP_TESTS_DOMAIN "localhost" --anchor="define( 'WP_DEBUG'," && wp config set WP_SITEURL "http://localhost:8889/" --anchor="define( 'WP_DEBUG'," && wp config set WP_HOME "http://localhost:8889/" --anchor="define( 'WP_DEBUG',""'

To Reproduce How, and what happened?

  1. It's a bit of effort, but, install @wordpress/env globally
  2. Run wp-env start --debug and note the bash errors

Expected behavior I was expecting it to behave exactly like running docker-compose locally. The potentially relevant documentation seems to indicate that it should be processed in the same way that I expect, but, in practice, something seems to be going wrong.

Logs This doesn't really seem related to be honest, everything is working perfectly fine!

Additional info multipass version

multipass   1.10.1+mac
multipassd  1.10.1+Mac
  • multipass info --all
Name:           docker
State:          Running
IPv4:           192.168.64.2
                172.17.0.1
                172.18.0.1
Release:        Ubuntu 22.04.1 LTS
Image hash:     4247b344c976 (Ubuntu 22.04 LTS)
Load:           0.11 0.13 0.16
Disk usage:     4.8G out of 38.6G
Memory usage:   539.1M out of 3.8G
Mounts:         /Users/obliviousharmony => /Users/obliviousharmony
                    UID map: 501:default
                    GID map: 20:default
  • multipass get local.driver
qemu

ObliviousHarmony avatar Aug 16 '22 21:08 ObliviousHarmony