docker-compose, WordPress and MariaDB, PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused

Solution:

your WordPress Instance and MySQL Instance isn’t connected. Try adding networks on the docker-compose.yml

nginx:
 ...
 networks:
  - your-network-name

mysql:
 ...
 networks:
  - your-network-name

wordpress:
 ...
 networks:
  - your-network-name

and on the bottom of the file add:

networks:
 your-network-name:
  driver: bridge

this is the way to configure docker to be connected each other