github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/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_trigger` 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 ### Dynamic image 31 32 ``` 33 data "docker_registry_image" "ubuntu" { 34 name = "ubuntu:precise" 35 } 36 37 resource "docker_image" "ubuntu" { 38 name = "${data.docker_registry_image.ubuntu.name}" 39 pull_trigger = "${data.docker_registry_image.ubuntu.sha256_digest}" 40 } 41 ``` 42 43 ## Argument Reference 44 45 The following arguments are supported: 46 47 * `name` - (Required, string) The name of the Docker image, including any tags. 48 * `keep_locally` - (Optional, boolean) If true, then the Docker image won't be 49 deleted on destroy operation. If this is false, it will delete the image from 50 the docker local storage on destroy operation. 51 * `pull_trigger` - (Optional, string) Used to store the image digest from the 52 registry and will cause an image pull when changed. Needed when using 53 the `docker_registry_image` [data source](/docs/providers/docker/d/registry_image.html) 54 to trigger an update of the image. 55 56 ## Attributes Reference 57 58 The following attributes are exported in addition to the above configuration: 59 60 * `latest` (string) - The ID of the image.