I created a small docker-compose.yml that was used as a charm to deploy small instances of WordPress. It looks like this:
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
But when I start it now (maybe from the moment the dockers were upgraded to Docker version 1.9.1, build a34a1d5 ), it fails
wordpress_1 | Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 10 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused
When I cat /etc/hosts for wordpress_1 , there are entries for MySQL:
172.17.0.10 mysql 12a564fdbc56 mariadb
and I can ping the MariaDB server.
When I docker-compose up , WordPress installs and after several restarts, the MariaDB container prints:
Version: '10.0.22-MariaDB-1~jessie' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
What is the point of indicating that it works, right?
How do I get WordPress to connect to the MariaDB container?
docker mariadb docker-compose wordpress
Harry
source share