WP-CLI and Drush in isolated Docker containers

Asked

Viewed 65 times

3

I’m starting to use Docker contêneres to instantiate local development environments, mainly for Wordpress and Drupal.

Two tools that I use a lot in my workflow are wp-cli and drush. Following the (little I learned from) Docker’s philosophy, I leave the database in one container, the CMS in another (linked to the comic with --link), and the CLI tool in a third container (connected to the comic with --link and using CMS folders with --volumes-from).

I can open in the browser the Drupal running containerized.

The installation screen appears, I inform the connection parameters and the installation successfully concludes. It seems to me that Drush is the one who, for some reason, gives error in accessing the other containers.

In theory, it should work. In practice, it’s only working pro wp-cli. Turns out it’s already worked for drush, and I can’t seem to remember what it was that I did differently so it would stop working.

Use Docker version 1.10.3, build f476348/1.10.3 (Fedora 23) at work and Fedora 24 at home (I did not check the version), in both the same error.


How I install the containers

Wordpress: https://gist.githubusercontent.com/ruda-almeida/36832b2a2632be985148f8950466e5ad/raw/122c6d7fe1fbd124f9a7309364ee27d35c78e71d/wp.sh

Drupal: https://gist.githubusercontent.com/ruda-almeida/36832b2a2632be985148f8950466e5ad/raw/122c6d7fe1fbd124f9a7309364ee27d35c78e71d/drupal.sh


Error message from Drush

Unable to load class Drush\Sql\Sql                                                                                                                  [error]
exception 'Drush\Sql\SqlException' with message 'Unable to find a matching SQL Class. Drush cannot find your database connection details.' in       [error]
/usr/bin/drushes/drush-8.1.3/commands/sql/sql.drush.inc:588
Stack trace:
#0 /usr/bin/drushes/drush-8.1.3/commands/sql/sql.drush.inc(455): drush_sql_get_class()
#1 [internal function]: drush_sql_cli()
#2 /usr/bin/drushes/drush-8.1.3/includes/command.inc(373): call_user_func_array('drush_sql_cli', Array)
#3 /usr/bin/drushes/drush-8.1.3/includes/command.inc(224): _drush_invoke_hooks(Array, Array)
#4 [internal function]: drush_command()
#5 /usr/bin/drushes/drush-8.1.3/includes/command.inc(192): call_user_func_array('drush_command', Array)
#6 /usr/bin/drushes/drush-8.1.3/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#7 /usr/bin/drushes/drush-8.1.3/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /usr/bin/drushes/drush-8.1.3/drush.php(12): drush_main()
#9 {main}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.