Mosquitto MQTT turns all devices off upon restart

Anyone knows why does my devices turns off when i restart the docker service and all my devices that reconnect will turn off? same for my devices even when its set to power retain on. When my devices restarts and connects to the mqtt it turns itself off too. Any idea?

It is very easy: You use the retain flag without really knowing what it does.