title: docker-compose wordpress mysql connection refused
body: <p>I've created a small <code>docker-compose.yml</code> which used to work like a charm to deploy small WordPress instances. It looks like this:</p>
  
  <pre><code>wordpress:
    image: wordpress:latest
    links:
     - mysql
    ports:
     - "1234:80"
    environment:
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_PASSWORD: "password"
      WORDPRESS_DB_HOST: mariadb
      MYSQL_PORT_3306_TCP: 3306
    volumes:
      - /srv/wordpress/:/var/www/html/
  mysql:
    image: mariadb:latest
    mem_limit: 256m
    container_name: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: "password"
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: "password"
    volumes:
      - /srv/mariadb:/var/lib/mysql
  </code></pre>
  
  <p>But when I start it now (maybe since docker update to Docker version 1.9.1, build <code>a34a1d5</code>), it fails</p>
  
  <pre><code>wordpress_1 | Warning: mysqli::mysqli(): (HY000/2002): Connection    refused in - on line 10
  wordpress_1 | 
  wordpress_1 | MySQL Connection Error: (2002) Connection refused
  </code></pre>
  
  <p>When I cat <code>/etc/hosts</code> of the <code>wordpress_1</code> there are entries for MySQL:</p>
  
  <pre><code>172.17.0.10 mysql 12a564fdbc56 mariadb
  </code></pre>
  
  <p>and I am able to ping the MariaDB server.</p>
  
  <p>When I <code>docker-compose up</code>, WordPress gets installed and after several restarts the MariaDB container prints:</p>
  
  <pre><code>Version: '10.0.22-MariaDB-1~jessie'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
  </code></pre>
  
  <p>Which schould indicate it to be running, isn't it?</p>
  
  <p>How do I get the WordPress to be able to connect to the MariaDB container?</p>