FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

docker_container

Manages the lifecycle of a Docker container.

Example Usage

# Start a container
resource "docker_container" "ubuntu" {
  name = "foo"
  image = "${docker_image.ubuntu.latest}"
}

# Find the latest Ubuntu precise image.
resource "docker_image" "ubuntu" {
  name = "ubuntu:precise"
}

Argument Reference

The following arguments are supported:

Ports

ports is a block within the configuration that can be repeated to specify the port mappings of the container. Each ports block supports the following:

Extra Hosts

host_entry is a block within the configuration that can be repeated to specify the extra host mappings for the container. Each host_entry block supports the following:

This is equivalent to using the --add-host option when using the run command of the Docker CLI.

Volumes

volumes is a block within the configuration that can be repeated to specify the volumes attached to a container. Each volumes block supports the following:

One of from_container, host_path or volume_name must be set.

Attributes Reference

The following attributes are exported:


See the source of this document at Terraform.io