Error when runing docker-compose up -d nginx redis mysql

Service 'mysql' failed to build: Get "https://registry-1.docker.io/v2/": x509: certificate has expired or is not yet valid: current time 2022-12-18T21:55:57+08:00 is before 2023-05-22T00:00:00Z

Solution

Shutdown wsl and restart it.
wsl --shutdown /h wsl -d Ubuntu-18.04 date