Auto restart running container or service on it on local code changes


I am looking for a way to auto restart the running container or the service running on it as soon as i make local changes. I am using volumes to mount my local changes onto the container/image and i can see the changes getting reflected onto the container but i need to restart the service or the container in order for those changes to take effect. is there a way to restart the service running on the container or the container itself as soon as local changes are detected?