解决方法分为两种场景

启动时配置

加入下面的参数即可

-v /etc/localtime:/etc/localtime:ro

已启动

docker cp /etc/localtime mysql:/etc/localtime
docker restart mysql

扩展-MYSQL查询当前时间

select current_timestamp;
MariaDB [(none)]> select current_timestamp;
+---------------------+
| current_timestamp   |
+---------------------+
| 2022-09-02 10:40:03 |
+---------------------+
1 row in set (0.251 sec)

MariaDB [(none)]>