Referencing locally built Docker images in Terraform
Yes, As we write terraform template is correct.
When you use terraform apply it will check local docker image list if it doesn't exit it will go to find registry as you define docker image.

If you don't want a pull image from the internet you can try the below steps. But at least you should have a base docker image of any Linux distribution.


Create a Dockerfile. 
Build Dockerfile as below command


# docker build -t image_name -f Dockerfile


Define the docker image as a template


resource "docker_container" "my_service" {
  image = "image_name"
  name  = "my-service"
}


By terraform init install terraform module and apply the terraform template.


# terraform init

# terraform apply -auto-approve