xxxxxxxxxx
#Flush changes and restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
xxxxxxxxxx
On windows, open Docker-desktop and click on the debug icon then you will find the restart button.
You can also consider "reset to factory defaults"
xxxxxxxxxx
import subprocess
def restart_docker_service():
subprocess.call(["systemctl", "restart", "docker"])
# Call the function to restart the Docker service
restart_docker_service()