title: "Temporary failure in name resolution": Symfony 5.3 Connection to MariaDB with Doctrine and Docker
body: <p>I've got my dev environment running in docker (nginx, php and mariadb) and try to create a database in symfony with doctrine. When I run <code>php bin/console doctrine:database:create </code>, I will get the following error:</p>
  <pre><code>[critical] Error thrown while running command &quot;doctrine:database:create&quot;. Message: &quot;An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution&quot;
  </code></pre>
  <p>My configuration in <code>.env</code> looks like this:</p>
  <pre><code>DATABASE_URL=&quot;mysql://admin:symfony-admin@db/symfony_test?serverVersion=mariadb-10.1&quot;
  </code></pre>
  <p>And this is my <code>docker-compose.yml</code>:</p>
  <pre><code>version: &quot;3.6&quot;
  services:
    web:
      image: nginx:latest
      ports:
        - &quot;8080:80&quot;
      volumes:
        - ./code:/code
        - ./site.conf:/etc/nginx/conf.d/site.conf
      depends_on:
        - php
  
    php:
      build: .
      volumes:
        - ./code:/code 
      links:
        - db
  
    db:
      image: mariadb:latest
      restart: always
      ports:
        - &quot;33006:3306&quot;
      volumes:
        - ./db:/docker-entrypoint-initdb.d/
      environment:
        MYSQL_ROOT_PASSWORD: 'symfony-root-pwd'
        MYSQL_DATABASE: 'symfony_db'
        MYSQL_USER: 'admin'
        MYSQL_PASSWORD: 'symfony-admin'
  </code></pre>
  <p>I also use adminer to have access to the database and there the login works.</p>
  <p>Does someone know why I can't create a database with doctrine?</p>
  <p>Cheers,</p>
  <p>Michael</p>
  <h2><strong>Solution:</strong></h2>
  <p>I found the solution by myself. The command <code>php bin/console doctrine:database:create </code> need to be run within the php docker container and not in the local terminal.
  So at first <code>docker-compose exec php /bin/bash</code> and then <code>php bin/console doctrine:database:create </code></p>