1. A method for restoring compliance of a virtual machine found to be non-compliant to a compliance rule, the method comprising detecting non-compliance of the virtual machine with the compliance rule using a compliance agent deployed on the virtual machine; detaching the virtual machine from a network; creating a copy of a compliance repository volume on a requested disk resource for the virtual machine; mounting the requested disk resource, having stored thereon the copy of the compliance repository volume, to the virtual machine; applying a remediation action to the virtual machine using content of the copy of the compliance repository volume to restore compliance of the virtual machine; and triggering, by the compliance agent, a compliance scan to ensure that the virtual machine complies with the compliance rule.