github.com/jsoriano/terraform@v0.6.7-0.20151026070445-8b70867fdd95/website/source/docs/providers/docker/r/container.html.markdown (about)

     1  ---
     2  layout: "docker"
     3  page_title: "Docker: docker_container"
     4  sidebar_current: "docs-docker-resource-container"
     5  description: |-
     6    Manages the lifecycle of a Docker container.
     7  ---
     8  
     9  # docker\_container
    10  
    11  Manages the lifecycle of a Docker container.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  # Start a container
    17  resource "docker_container" "ubuntu" {
    18    name = "foo"
    19    image = "${docker_image.ubuntu.latest}"
    20  }
    21  
    22  # Find the latest Ubuntu precise image.
    23  resource "docker_image" "ubuntu" {
    24    name = "ubuntu:precise"
    25  }
    26  ```
    27  
    28  ## Argument Reference
    29  
    30  The following arguments are supported:
    31  
    32  * `name` - (Required, string) The name of the Docker container.
    33  * `image` - (Required, string) The ID of the image to back this container.
    34    The easiest way to get this value is to use the `docker_image` resource
    35    as is shown in the example above.
    36  
    37  * `command` - (Optional, list of strings) The command to use to start the
    38      container. For example, to run `/usr/bin/myprogram -f baz.conf` set the
    39      command to be `["/usr/bin/myprogram", "-f", "baz.conf"]`.
    40  * `dns` - (Optional, set of strings) Set of DNS servers.
    41  * `env` - (Optional, set of strings) Environmental variables to set.
    42  * `links` - (Optional, set of strings) Set of links for link based
    43    connectivity between containers that are running on the same host.
    44  * `hostname` - (Optional, string) Hostname of the container.
    45  * `domainname` - (Optional, string) Domain name of the container.
    46  * `must_run` - (Optional, bool) If true, then the Docker container will be
    47    kept running. If false, then as long as the container exists, Terraform
    48    assumes it is successful.
    49  * `ports` - (Optional) See [Ports](#ports) below for details.
    50  * `privileged` - (Optional, bool) Run container in privileged mode.
    51  * `publish_all_ports` - (Optional, bool) Publish all ports of the container.
    52  * `volumes` - (Optional) See [Volumes](#volumes) below for details.
    53  
    54  <a id="ports"></a>
    55  ## Ports
    56  
    57  `ports` is a block within the configuration that can be repeated to specify
    58  the port mappings of the container. Each `ports` block supports
    59  the following:
    60  
    61  * `internal` - (Required, int) Port within the container.
    62  * `external` - (Required, int) Port exposed out of the container.
    63  * `ip` - (Optional, string) IP address/mask that can access this port.
    64  * `protocol` - (Optional, string) Protocol that can be used over this port,
    65    defaults to TCP.
    66  
    67  <a id="volumes"></a>
    68  ## Volumes
    69  
    70  `volumes` is a block within the configuration that can be repeated to specify
    71  the volumes attached to a container. Each `volumes` block supports
    72  the following:
    73  
    74  * `from_container` - (Optional, string) The container where the volume is
    75    coming from.
    76  * `container_path` - (Optional, string) The path in the container where the
    77    volume will be mounted.
    78  * `host_path` - (Optional, string) The path on the host where the volume
    79    is coming from.
    80  * `read_only` - (Optional, bool) If true, this volume will be readonly.
    81    Defaults to false.
    82  
    83  ## Attributes Reference
    84  
    85  The following attributes are exported:
    86  
    87   * `ip_address` - The IP address of the container as read from its
    88     NetworkSettings.
    89   * `ip_prefix_length` - The IP prefix length of the container as read from its
    90     NetworkSettings.
    91   * `gateway` - The network gateway of the container as read from its
    92     NetworkSettings.
    93   * `bridge` - The network bridge of the container as read from its
    94     NetworkSettings.