In case you are using colima try the bellow command in the terminal.
sudo ln -s "$HOME/.colima/default/docker.sock" /var/run/docker.sock
This will expose the colima socket file through the default location docker exposes the socket file which is /var/run/docker.sock