title: docker container throws error: php_network_getaddresses: getaddrinfo failed: Name or service not known
body: <p>Please check my docker-compose file:</p>
  
  <pre><code>version: '2'
  services:
    db:
      image: mysql:latest
      networks:
        app_net:
          ipv4_address: 172.16.238.10
          ipv6_address: 2001:3984:3989::10
      volumes:
        - "./data/db:/var/lib/mysql"
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: wordpress
        MYSQL_DATABASE: wordpress
        MYSQL_USER: wordpress
        MYSQL_PASSWORD: wordpress
    wordpress:
      image: wordpress
      links:
       - db
      ports:
        - "8000:80"
      environment:
       - WORDPRESS_DB_PASSWORD=wordpress
      networks:
        app_net:
          ipv4_address: 172.16.238.12
          ipv6_address: 2001:3984:3989::10
      volumes:
       - ./code:/code
       - ./html:/var/www/html
  
  
  networks:
    app_net:
      driver: bridge
      driver_opts:
        com.docker.network.enable_ipv6: "true"
      ipam:
        driver: default
        config:
        - subnet: 172.16.238.0/24
          gateway: 172.16.238.1
        - subnet: 2001:3984:3989::/64
          gateway: 2001:3984:3989::1
  </code></pre>
  
  <p>Now Two container are running :
  <a href="https://i.stack.imgur.com/5sqYL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5sqYL.png" alt="enter image description here"></a></p>
  
  <p>IP address for the two containers are properly configured.  But when i connect to the <a href="http://172.16.238.12:8000/" rel="noreferrer">http://172.16.238.12:8000/</a> (172.16.238.12 - Is the IP Address of the wordpress). It says, "Unable to connect".</p>
  
  <p>When i check logs files of the docker_wordpress_1, it is showing me : </p>
  
  <pre><code>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
  </code></pre>
  
  <p>I didnot understand what went wrong. </p>