Dockerizing an VM

Hello, I’ve read that is posible to dockerize an VM, I would like to try to do it, but i really dont have any idea how to do it.
Can someone help me explaining me how should i do please?
I dont know about the commands to do it.
Thanks.