github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/docker/index.html.markdown (about) 1 --- 2 layout: "docker" 3 page_title: "Provider: Docker" 4 sidebar_current: "docs-docker-index" 5 description: |- 6 The Docker provider is used to interact with Docker containers and images. 7 --- 8 9 # Docker Provider 10 11 The Docker provider is used to interact with Docker containers and images. 12 It uses the Docker API to manage the lifecycle of Docker containers. Because 13 the Docker provider uses the Docker API, it is immediately compatible not 14 only with single server Docker but Swarm and any additional Docker-compatible 15 API hosts. 16 17 Use the navigation to the left to read about the available resources. 18 19 ## Example Usage 20 21 ```hcl 22 # Configure the Docker provider 23 provider "docker" { 24 host = "tcp://127.0.0.1:2376/" 25 } 26 27 # Create a container 28 resource "docker_container" "foo" { 29 image = "${docker_image.ubuntu.latest}" 30 name = "foo" 31 } 32 33 resource "docker_image" "ubuntu" { 34 name = "ubuntu:latest" 35 } 36 ``` 37 38 ## Registry Credentials 39 40 The initial (current) version of the Docker provider **doesn't** support registry authentication. 41 This limits any use cases to public images for now. 42 43 ## Argument Reference 44 45 The following arguments are supported: 46 47 * `host` - (Required) This is the address to the Docker host. If this is 48 blank, the `DOCKER_HOST` environment variable will also be read. 49 50 * `cert_path` - (Optional) Path to a directory with certificate information 51 for connecting to the Docker host via TLS. If this is blank, the 52 `DOCKER_CERT_PATH` will also be checked. 53 54 * `ca_material`, `cert_material`, `key_material`, - (Optional) Content of `ca.pem`, `cert.pem`, and `key.pem` files 55 for TLS authentication. Cannot be used together with `cert_path`. 56 57 ~> **NOTE on Certificates and `docker-machine`:** As per [Docker Remote API 58 documentation](https://docs.docker.com/engine/reference/api/docker_remote_api/), 59 in any docker-machine environment, the Docker daemon uses an encrypted TCP 60 socket (TLS) and requires `cert_path` for a successful connection. As an alternative, 61 if using `docker-machine`, run `eval $(docker-machine env <machine-name>)` prior 62 to running Terraform, and the host and certificate path will be extracted from 63 the environment.