Building containers with Dockerfiles is probably the most common way of doing this, but this does not mean that this is the best way.
First of all, even if you are in a very good place in your automation path and you have a lot of Ansible roles written for your infrastructure, you can't leverage them in Dockerfiles, so you would end up replicating your work to create containers. Aside from the time required to do this and the fact that you need to learn a new language to do so, it is very rare that a company is able to drop all their infrastructure and switch to containers overnight. This means that you need to keep two copies of the same automation section active and up-to-date, thus putting yourself in the position to make mistakes and have inconsistent behaviors between environments.
If this is not enough of a problem, this...