I'm confused about the image property in the docker\_container resource of a terraform tf file.

The following contents you see in all the tutorials:

```
resource "docker_image" "nginx" {
  name         = "nginx:latest"
  keep_locally = false
}

resource "docker_container" "nginx" {
  image = docker_image.nginx.latest
  name  = "tutorial"
  ports {
    internal = 80
    external = 8000
  }
}

```

This pulls the latest image.

But if you want a previous image, you need to specify the Digest, like this:

```
resource "docker_image" "nginx" {
  name         = "nginx:1.22.0@sha256:f2dfca5620b64b8e5986c1f3e145735ce6e291a7dc3cf133e0a460dca31aaf1f"
  keep_locally = false
}

```

Then you need to create a container on that image with the docker\_container Resource.
But there is no way you can specify that previous image tag or digest.

Things like image = docker\_image.nginx:1.22.0@sha256:f2dfca5620b64b8e5986c1f3e145735ce6e291a7dc3cf133e0a460dca31aaf1f all fail. Various syntax versions are tried (quotes, no-quotes, etc, etc). They all result in an error.

The only way I could get this working was with the following:

```
resource "docker_image" "nginx" {
  name         = "nginx:1.22.0@sha256:f2dfca5620b64b8e5986c1f3e145735ce6e291a7dc3cf133e0a460dca31aaf1f"
  keep_locally = false
}

resource "docker_container" "nginx" {
  image = docker_image.nginx.latest
  name  = "Terraform-Nginx"
  ports {
    internal = 80
    external = 8000
  }
}

```

But now I'm confused.

What does ".latest" even mean in the image property of the docker\_container resource?