1.1 KiB
1.1 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
docker | Docker: docker_image | docs-docker-resource-image | Downloads and exports the ID of a Docker image. |
docker_image
Downloads and exports the ID of a Docker image. This can be used alongside docker_container to programmatically get the latest image IDs without having to hardcode them.
Example Usage
# Find the latest Ubuntu precise image.
resource "docker_image" "ubuntu" {
image = "ubuntu:precise"
}
# Access it somewhere else with ${docker_image.ubuntu.latest}
Argument Reference
The following arguments are supported:
name
- (Required) The name of the Docker image, including any tags.keep_updated
- (Optional) If true, then the Docker image will always be updated on the host to the latest. If this is false, as long as an image is downloaded with the correct tag, it won't be redownloaded if there is a newer image.
Attributes Reference
The following attributes are exported in addition to the above configuration:
latest
(string) - The ID of the image.