Faced the same problem, I was not able to run wordpress docker container with mysql version 8 as its default authentication mechanism is caching_sha2_password instead of mysql_native_password.
In order to fix this problem we must reset default authentication mechanism to mysql_native_password.
Find my.cnf file in your mysql installation, usually on a linux machine it is at the following location - /etc/mysql
Edit my.cnf file and add following line just under heading [mysqld]
default_authentication_plugin= mysql_native_password
Save the file then log into mysql command line using root user
run command FLUSH PRIVILEGES;