No, you can’t. But what you can do is to run a docker compose exec statement followed by the wp CLI command. The command will still be fired in the container but you will have the feeling you’re still on your host.
To make it feel like it would be a host command, you could create an alias (works on Mac, Linux, and even Windows PowerShell) and hide the actual command behind the alias.
A short google search should show how aliases can be created for the shell you are using.
wp-cli plugin install woocommerce --activate
Installing WooCommerce (9.6.2)
Downloading installation package from https://downloads.wordpress.org/plugin/woocommerce.9.6.2.zip...
Using cached file '/home/www-data/.wp-cli/cache/plugin/woocommerce-9.6.2.zip'...
Unpacking the package...
Warning: Could not create directory. "/var/www/html/wp-content/upgrade"
Warning: The 'woocommerce' plugin could not be found.
Error: No plugins installed.
I have this issue now
i try to run “wp-cli plugin install woocommerce --activate”
But it’s sayes “Warning: Could not create directory. “/var/www/html/wp-content/upgrade”
Warning: The ‘woocommerce’ plugin could not be found.
Error: No plugins installed.”
Add user: '33:33' to the wpcli service definition, to make sure the wpcli is executed with the uid:gid that grants it access to the data in the volume.
Thank you for your help. It really means a lot to me; now Semmes is working. However, I get a weird error when I run my code.
PHP Warning: foreach() argument must be of type array|object, string given in /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-countries.php on line 308
Warning: foreach() argument must be of type array|object,
> string given in /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-countries.php on line 308