Docker doesn't start after system restart

I’ve restarted my ubuntu server and my docker didn’t restart, and when I use any docker command I receive the error below because service restart doesn’t solve the problem.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

To solve the problem I have always to manually remove /var/snap/docker/current/run/docker.pid and restart docker.
Is there any way to avoid this?

See the discussion in Docker fails to restart after power failure