github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/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  <div class="alert alert-block alert-info">
    20  <strong>Note:</strong> The Docker provider is new as of Terraform 0.4.
    21  It is ready to be used but many features are still being added. If there
    22  is a Docker feature missing, please report it in the GitHub repo.
    23  </div>
    24  
    25  ## Example Usage
    26  
    27  ```
    28  # Configure the Docker provider
    29  provider "docker" {
    30      host = "tcp://127.0.0.1:2376/"
    31  }
    32  
    33  # Create a container
    34  resource "docker_container" "foo" {
    35      image = "${docker_image.ubuntu.latest}"
    36      name = "foo"
    37  }
    38  
    39  resource "docker_image" "ubuntu" {
    40      name = "ubuntu:latest"
    41  }
    42  ```
    43  
    44  ## Registry Credentials
    45  
    46  The initial (current) version of the Docker provider **doesn't** support registry authentication.
    47  This limits any use cases to public images for now.
    48  
    49  ## Argument Reference
    50  
    51  The following arguments are supported:
    52  
    53  * `host` - (Required) This is the address to the Docker host. If this is
    54    blank, the `DOCKER_HOST` environment variable will also be read.
    55  
    56  * `cert_path` - (Optional) Path to a directory with certificate information
    57    for connecting to the Docker host via TLS. If this is blank, the
    58    `DOCKER_CERT_PATH` will also be checked.
    59  
    60  ~> **NOTE on Certificates and `docker-machine`:**  As per [Docker Remote API
    61  documentation](https://docs.docker.com/engine/reference/api/docker_remote_api/),
    62  in any docker-machine environment, the Docker daemon uses an encrypted TCP
    63  socket (TLS) and requires `cert_path` for a successful connection. As an alternative,
    64  if using `docker-machine`, run `eval $(docker-machine env <machine-name>)` prior
    65  to running Terraform, and the host and certificate path will be extracted from
    66  the environment.