I have a docker mysql image running, following is what the docker-compose.yml file looks like:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: \"\
Your yml file looks good.
You can directly connect docker container directly as it already mapped with local port 3306. Just goto terminal and run
mysql -h 127.0.0.1 -u root -p
Note: you must have access to mysql command line. If mysql command show an error, check '/usr/local/mysql/bin' other wise you can not connect to mysql server. In other word you must have mysql client on your machine.