docker-compose + external container
<p>I have started a docker container with the following command</p>

<pre><code>docker run --name mysql --restart always -p 3306:3306 -v /var/lib/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:5.7.14
</code></pre>

<p>and then would like to connect a wordpress site with the following docker-compose.yml file </p>

<pre><code>version: '2'

services:
    wordpress:
        image: wordpress
        external_links:
            - mysql:mysql
        ports:
            - 80:80
    environment:
        WORDPRESS_DB_USER: root
        WORDPRESS_DB_PASSWORD: password
    volumes:
        - /var/www/somesite.com:/var/www/html
</code></pre>

<p>But I keep getting the following error</p>

<pre><code>Starting somesitecom_wordpress_1
Attaching to somesitecom_wordpress_1
wordpress_1  | 
wordpress_1  | Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 19
wordpress_1  | 
wordpress_1  | MySQL Connection Error: (2002) Connection refused
</code></pre>

<p>It seems like the <code>external_links</code> isn't working.</p>

<p>Any idea what I am doing wrong?</p>