If you think Ansible and Docker are solving the same problem you haven’t understood yet why people use containers for deploying software.
We use them because then what’s running in prodcution is 100% the same as is running locally when testing the application.
You can hardly get there using Ansible.