{"action":"created","issue":{"url":"https://api.github.com/repos/drush-ops/drush/issues/3621","repository_url":"https://api.github.com/repos/drush-ops/drush","labels_url":"https://api.github.com/repos/drush-ops/drush/issues/3621/labels{/name}","comments_url":"https://api.github.com/repos/drush-ops/drush/issues/3621/comments","events_url":"https://api.github.com/repos/drush-ops/drush/issues/3621/events","html_url":"https://github.com/drush-ops/drush/issues/3621","id":342024683,"node_id":"MDU6SXNzdWUzNDIwMjQ2ODM=","number":3621,"title":"`drush cron` in container cannot connect to database in another container","user":{"login":"mattacular","id":1387414,"node_id":"MDQ6VXNlcjEzODc0MTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1387414?v=4","gravatar_id":"","url":"https://api.github.com/users/mattacular","html_url":"https://github.com/mattacular","followers_url":"https://api.github.com/users/mattacular/followers","following_url":"https://api.github.com/users/mattacular/following{/other_user}","gists_url":"https://api.github.com/users/mattacular/gists{/gist_id}","starred_url":"https://api.github.com/users/mattacular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattacular/subscriptions","organizations_url":"https://api.github.com/users/mattacular/orgs","repos_url":"https://api.github.com/users/mattacular/repos","events_url":"https://api.github.com/users/mattacular/events{/privacy}","received_events_url":"https://api.github.com/users/mattacular/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-17T18:01:29Z","updated_at":"2018-07-18T14:06:46Z","closed_at":"2018-07-17T18:12:25Z","author_association":"CONTRIBUTOR","body":"**Describe the bug**\r\nWhen running Drupal 8 in a container for local development, if the database is running in another container, `drush cron` command fails seemingly due to DB connection issues. Other commands that interact with the database (such as `drush cr` and `drush status` work fine).\r\n\r\n**To Reproduce**\r\nStart a database (mysql or mariadb) in a container, from host machine or another container run `drush cron` command.\r\n\r\n**Expected behavior**\r\nCron command will run.\r\n\r\n**Actual behavior**\r\nGeneric db connection error is thrown:\r\n\r\n```\r\nroot@snip:/var/www/html# drush status\r\n Drupal version         :  8.5.4\r\n Site URI               :  http://default\r\n Database driver        :  mysql\r\n Database hostname      :  mariadb\r\n Database port          :  3306\r\n Database username      :  casautil\r\n Database name          :  casablanca\r\n PHP executable         :  /usr/local/bin/php\r\n PHP configuration      :  /usr/local/etc/php/php.ini\r\n PHP OS                 :  Linux\r\n Drush script           :  /tmp/local/vendor/drush/drush/drush.php\r\n Drush version          :  8.1.17\r\n Drush temp directory   :  /tmp\r\n Drush configuration    :  /tmp/local/docroot/sites/default/drushrc.php\r\n Drush alias files      :\r\n Drupal root            :  /tmp/local/docroot\r\n Drupal Settings File   :  sites/default/settings.php\r\n Site path              :  sites/default\r\n Sync config path       :  ../config_sync/default\r\n\r\nroot@snip:/var/www/html# drush cron\r\nCommand core-cron needs a higher bootstrap level to run - you will   [error]\r\nneed to invoke drush from a more functional Drupal environment to run\r\nthis command.\r\nThe drush command 'cron' could not be executed.                      [error]\r\nDrush was not able to start (bootstrap) the Drupal database.         [error]\r\nHint: This may occur when Drush is trying to:\r\n * bootstrap a site that has not been installed or does not have a\r\nconfigured database. In this case you can select another site with a\r\nworking database setup by specifying the URI to use with the --uri\r\nparameter on the command line. See `drush topic docs-aliases` for\r\ndetails.\r\n * connect the database through a socket. The socket file may be\r\nwrong or the php-cli may have no access to it in a jailed shell. See\r\nhttp://drupal.org/node/1428638 for details.\r\n\r\nDrush was attempting to connect to:\r\n Drupal version         :  8.5.4\r\n Site URI               :  http://default\r\n Database driver        :  mysql\r\n Database hostname      :  mariadb\r\n Database port          :  3306\r\n Database username      :  casautil\r\n Database name          :  casablanca\r\n PHP executable         :  /usr/local/bin/php\r\n PHP configuration      :  /usr/local/etc/php/php.ini\r\n PHP OS                 :  Linux\r\n Drush script           :  /tmp/local/vendor/drush/drush/drush.php\r\n Drush version          :  8.1.17\r\n Drush temp directory   :  /tmp\r\n Drush configuration    :  /tmp/local/docroot/sites/default/drushrc\r\n                           .php\r\n Drush alias files      :\r\n Drupal root            :  /tmp/local/docroot\r\n Drupal Settings File   :  sites/default/settings.php\r\n Site path              :  sites/default\r\n Sync config path       :  ../config_sync/default\r\n```\r\n\r\n\r\n**Workaround**\r\nTheoretically one could share the socket file using Docker volumes to mount it in both containers but configuring this correctly is tricky.\r\n\r\n### System Configuration\r\n| Q               | A\r\n| --------------- | ---\r\n| Drush version?  | 8.1.17\r\n| Drupal version? | 8.5.4\r\n| PHP version     | 7.1\r\n| OS?             | Linux/Debian Stretch\r\n\r\n**Additional information**\r\nThis is only an issue when the database is containerized (which typically would only be done for local development).\r\n"},"comment":{"url":"https://api.github.com/repos/drush-ops/drush/issues/comments/405943450","html_url":"https://github.com/drush-ops/drush/issues/3621#issuecomment-405943450","issue_url":"https://api.github.com/repos/drush-ops/drush/issues/3621","id":405943450,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTk0MzQ1MA==","user":{"login":"weitzman","id":7740,"node_id":"MDQ6VXNlcjc3NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/7740?v=4","gravatar_id":"","url":"https://api.github.com/users/weitzman","html_url":"https://github.com/weitzman","followers_url":"https://api.github.com/users/weitzman/followers","following_url":"https://api.github.com/users/weitzman/following{/other_user}","gists_url":"https://api.github.com/users/weitzman/gists{/gist_id}","starred_url":"https://api.github.com/users/weitzman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weitzman/subscriptions","organizations_url":"https://api.github.com/users/weitzman/orgs","repos_url":"https://api.github.com/users/weitzman/repos","events_url":"https://api.github.com/users/weitzman/events{/privacy}","received_events_url":"https://api.github.com/users/weitzman/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T14:06:46Z","updated_at":"2018-07-18T14:06:46Z","author_association":"MEMBER","body":"FYI we already give a better error message in Drush9\r\n\r\nhttps://github.com/drush-ops/drush/blob/34f7b17942f0dd83e17716096a71db846cca590b/src/Boot/DrupalBoot.php#L227-L229"}}
{"actor":{"display_login":"weitzman"}}