Docker-to-docker Mysql connection
First of all are the containers visible to one another i.e. can you ping the mysql box from the webserver?

If not it is a visibility issue, try creating a docker network to put the two containers within.

First create a docker network:

docker network create lamp-network


You can see this by the following command:

docker network ls


Now start your two containers with the additional flag:

--net lamp-network


Now try pinging and seeing if you have connection, if so then MySQL should work, although depending on setup you may have to comment out the bind-address from the config.