Magento2 With Redis, Error: MySQL adapter: Missing required configuration option ‘host’ (Sometimes)

I have configured Magento2.3.4 on docker(windows 10 using docker toolbox). Then I added another service "redis" into my docker-compose file and started using redis for backend cache and page cache in Magento2.3.4. I’m getting "MySQL adapter: Missing required configuration option ‘host’" sometimes not always. Even frontend working but not backend. I teardown all docker containers and removed all docker volumes, build fresh from the docker compose file and now not able to setup upgrade. I debug a little and found that anyhow Magento is trying to connect to MySql multiple times and in the last attempt database configuration is empty (but in env.php) it’s there.

Source: Docker Questions