No, you should not use terraform with Docker. Use something like microk8s or docker-compose to spin up containers for local development, then run terraform against k8s/ECS/your platform of choice to codify the infrastructure as code.
They don't operate at the same level, so it's common that a project would utilise both. For instance Terraform can create your K8s cluster, that you then later use as a target to run your containers