I am trying to deviate a list to container in yang. I tried going through RFC#6020, and I couldn't figure-out how to deviate on the container level.
You can't change the type of a yang node.
However, you can use deviate not-supported
on the list and deviate add
on the parent node to create a new container with the same name as the list. The child elements of the list will be lost.
What you try to achieve is not a common use case and deviation modules are not designed to do what you request. A deviation should be used as a last resort to let netconf clients know that some part of the yang modules is not supported or only with restrictions.