title: Symfony PDO Connection in Test Environment
body: <p>i have a symfony environment running on a docker setup. Via docker-compose.yml (version 2) I start several containers. Following containers a relevant here:</p>
  
  <p>phpfpm, nginx and mariadb</p>
  
  <p>If i open my symfony project via browser it successfully connects to my database (on container called "mariadb"). Records from tables in my database are displayed.  Even if i execute console commands to update my database schema it will work and changes are applied to my database.</p>
  
  <p>Now i want to write functional / integration tests that run test against a second database on the same host (mariadb).</p>
  
  <p>This is how i try to connect:</p>
  
  <pre><code>$dsn = sprintf(
          'mysql:host=%s;port=%s',
          'mariadb',
          3306
      );
  
  $pdo = new PDOConnection(
      $dsn,
      'otk_dbuser',
      'testpass'
  );
  </code></pre>
  
  <p>But the result is the following message:</p>
  
  <pre><code>SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
    /opt/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47
    /opt/project/src/TestingBundle/Tests/DatabaseTestCase.php:56
    /opt/project/src/TestingBundle/Tests/DatabaseTestCase.php:18
  </code></pre>
  
  <p>Could you please give me some help?</p>
  
  <p>Kind regards,
  Max</p>