github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/docker/r/image.html.markdown (about) 1 --- 2 layout: "docker" 3 page_title: "Docker: docker_image" 4 sidebar_current: "docs-docker-resource-image" 5 description: |- 6 Pulls a Docker image to a given Docker host. 7 --- 8 9 # docker\_image 10 11 -> **Note:** The initial (current) version of this resource can only pull **public** images **from the official Docker Hub Registry**. 12 13 Pulls a Docker image to a given Docker host from a Docker Registry. 14 15 This resource will *not* pull new layers of the image automatically unless used in 16 conjunction with [`docker_registry_image`](/docs/providers/docker/d/registry_image.html) 17 data source to update the `pull_triggers` field. 18 19 ## Example Usage 20 21 ``` 22 # Find the latest Ubuntu precise image. 23 resource "docker_image" "ubuntu" { 24 name = "ubuntu:precise" 25 } 26 27 # Access it somewhere else with ${docker_image.ubuntu.latest} 28 29 ``` 30 31 ### Dynamic image 32 33 ``` 34 data "docker_registry_image" "ubuntu" { 35 name = "ubuntu:precise" 36 } 37 38 resource "docker_image" "ubuntu" { 39 name = "${data.docker_registry_image.ubuntu.name}" 40 pull_triggers = ["${data.docker_registry_image.ubuntu.sha256_digest}"] 41 } 42 ``` 43 44 ## Argument Reference 45 46 The following arguments are supported: 47 48 * `name` - (Required, string) The name of the Docker image, including any tags. 49 * `keep_locally` - (Optional, boolean) If true, then the Docker image won't be 50 deleted on destroy operation. If this is false, it will delete the image from 51 the docker local storage on destroy operation. 52 * `pull_triggers` - (Optional, list of strings) List of values which cause an 53 image pull when changed. This is used to store the image digest from the 54 registry when using the `docker_registry_image` [data source](/docs/providers/docker/d/registry_image.html) 55 to trigger an image update. 56 * `pull_trigger` - **Deprecated**, use `pull_triggers` instead. 57 58 59 ## Attributes Reference 60 61 The following attributes are exported in addition to the above configuration: 62 63 * `latest` (string) - The ID of the image.