The below content is copied from another source, and kept here in case original source is lost.

Open up Kaspersky and select Settings (bottom left) and then select Protection from the side menu and select Firewall.

Open Configure packet rules.

Select Local Services (TCP) and Edit.

Finally, remove the port number from your Local ports (in my case 445) and save.

You should now be able to share your drive without disabling Kaspersky firewall or applying any other temporary “fixes“.

Source: https://matthewhorne.me/docker-drive-sharing-seems-blocked-firewall-kaspersky/