Can’t connect to mysql docker image
You should allow the user within MySQL to connect from the IP of your host machine.Do not forget to flush privileges after changing user in MySQL
GRANT CREATE USER ON *.* TO 'root'@'%';
And restart the mysql instance
Also there is a chance to have mysql bind to 127.0.0.1 via my.cnf. If it is so - change the bind to 0.0.0.0 to get it accessible via any IP