Does “massscan-webserver” connect to mysql using a user name and password? If so have you configured it in your webserver’s settings? There seems to exist no environment variables for “massscan-webserver” container.
as a trouble shooting step install mysql cli client in webserver and see if you can manually connect to mysql server using the credentials in config.php
it looks to be 100% that the container is not allowed to connect to the other database container.
root@c674e4c6c541:/var/www/html# mysql -h database
ERROR 1130 (HY000): Host '172.24.0.3' is not allowed to connect to this MySQL server
root@c674e4c6c541:/var/www/html# mysql -h database -u docker
ERROR 1130 (HY000): Host '172.24.0.3' is not allowed to connect to this MySQL server
root@c674e4c6c541:/var/www/html# mysql -h database -u root
ERROR 1130 (HY000): Host '172.24.0.3' is not allowed to connect to this MySQL server
root@c674e4c6c541:/var/www/html#