Open heyyoyo opened 9 years ago
Mmm, it likely needs an update to 8.x.
I'm not sure to understand it's supposed to work. In my settings.php my host is equal to db which is the link to my container of mysql defined in container tutum/apache-php Drupal understands this host because php is executed inside this container tutum. But when drush is executed how drush is supposed to know what is this host db ? I hope my question is clear
Just updated to 8.0.0-beta11.. Mind testing it? Thanks!
Is your database in another container? Will have to share the port with the Drush container.
Hi Rob, Thanks for your update. I just tested it (on another machine) but still drush don't succeed to connect to my db. Yes mysql is in its own container. i'm using the official docker images. I just looked the dockerfile, the regular port 3306 is exposed. Hum by just writing that, I understand that I need also to open this port in my docker-compose.yml file :-)
So my environment that I'm trying to achieve is composed of 3 containers: tutum/apache-php mysql official drush/drush
here is my docker-compose.yml:
web:
image: tutum/apache-php
ports:
- "80:80"
volumes:
- /var/www:/var/www
- /var/www/docker/php.ini:/etc/php5/apache2/conf.d/30-custom.ini
- /var/www/docker/sites:/etc/apache2/sites-enabled
links:
- db:db
db:
image: mysql
ports:
- "3306:3306"
volumes:
- /var/lib/boot2docker/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
After executing on a fresh drupal:
drush en devel -y
I tried to add the uri but with no luck.
docker@boot2docker:/var/www/d7$ drush -l http://d7 en devel -y
Command pm-enable needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en devel' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.38
Site URI : http://d7
Database driver : mysql
Database hostname : db
Database port : 3306
Database username : root
Database name : d7
PHP configuration :
PHP OS : Linux
Drush script : /root/composer/vendor/drush/drush/drush.
php
Drush version : 8.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /app
Site path : sites/default
I tried to modify my alias to drush: docker run --rm --link docker_db_1:db -v $(pwd):/app drush/drush
But still no luck.
In my case I am using composer with drupal and was getting the same error. I had pulled my drupal instance down but I had not ran composer update in case anyone is getting a similiar error. https://www.lullabot.com/articles/goodbye-drush-make-hello-composer
I'm using a personnal web container based on tutum/apache-php linked to the mysql container(image mysql)
in my bootlocal.sh I created an alias for drush like this:
as soon as I try to run drush with database operations, for example
drush sqlc
I get this error:Any help will be appreciated. thanks