title: Wordpress on docker-compose no run
body: <p>This is my docker-compose.yml</p>
  
  <pre><code>version: '2'
  services:
    wordpress:
      image: wordpress
      ports:
        - "8080:80"
      environment:
        WORDPRESS_DB_PASSWORD: example
    db:
      image: mysql:5.7
      environment:
        MYSQL_ROOT_PASSWORD: example
  </code></pre>
  
  <p>the services run normally, but, a  few seconds later, the wordpress container stop.</p>
  
  <p>This is my docker logs wordpress container:</p>
  
  <pre><code>WordPress not found in /var/www/html - copying now...
  Complete! WordPress has been successfully copied to /var/www/html
  
  MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
  
  Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
  
  Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  
  MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
  Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  
  MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
  
  Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 10
  </code></pre>
  
  <p>Why does this happen?</p>