--- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "docker_container Resource - terraform-provider-docker" subcategory: "" description: |- --- # docker_container (Resource) ## Schema ### Required - **image** (String) - **name** (String) ### Optional - **attach** (Boolean) - **capabilities** (Block Set, Max: 1) (see [below for nested schema](#nestedblock--capabilities)) - **command** (List of String) - **cpu_set** (String) - **cpu_shares** (Number) - **destroy_grace_seconds** (Number) - **devices** (Block Set) (see [below for nested schema](#nestedblock--devices)) - **dns** (Set of String) - **dns_opts** (Set of String) - **dns_search** (Set of String) - **domainname** (String) - **entrypoint** (List of String) - **env** (Set of String) - **group_add** (Set of String) Additional groups for the container user - **healthcheck** (Block List, Max: 1) A test to perform to check that the container is healthy (see [below for nested schema](#nestedblock--healthcheck)) - **host** (Block Set) (see [below for nested schema](#nestedblock--host)) - **hostname** (String) - **id** (String) The ID of this resource. - **init** (Boolean) - **ipc_mode** (String) IPC sharing mode for the container - **labels** (Block Set) (see [below for nested schema](#nestedblock--labels)) - **links** (Set of String, Deprecated) - **log_driver** (String) - **log_opts** (Map of String) - **logs** (Boolean) - **max_retry_count** (Number) - **memory** (Number) - **memory_swap** (Number) - **mounts** (Block Set) Specification for mounts to be added to containers created as part of the service (see [below for nested schema](#nestedblock--mounts)) - **must_run** (Boolean) - **network_alias** (Set of String, Deprecated) Set an alias for the container in all specified networks - **network_mode** (String) - **networks** (Set of String, Deprecated) - **networks_advanced** (Block Set) (see [below for nested schema](#nestedblock--networks_advanced)) - **pid_mode** (String) - **ports** (Block List) (see [below for nested schema](#nestedblock--ports)) - **privileged** (Boolean) - **publish_all_ports** (Boolean) - **read_only** (Boolean) - **remove_volumes** (Boolean) - **restart** (String) - **rm** (Boolean) - **security_opts** (Set of String) List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration - **shm_size** (Number) - **start** (Boolean) - **stdin_open** (Boolean) - **sysctls** (Map of String) - **tmpfs** (Map of String) - **tty** (Boolean) - **ulimit** (Block Set) (see [below for nested schema](#nestedblock--ulimit)) - **upload** (Block Set) (see [below for nested schema](#nestedblock--upload)) - **user** (String) - **userns_mode** (String) - **volumes** (Block Set) (see [below for nested schema](#nestedblock--volumes)) - **working_dir** (String) ### Read-Only - **bridge** (String) - **container_logs** (String) - **exit_code** (Number) - **gateway** (String, Deprecated) - **ip_address** (String, Deprecated) - **ip_prefix_length** (Number, Deprecated) - **network_data** (List of Object) (see [below for nested schema](#nestedatt--network_data)) ### Nested Schema for `capabilities` Optional: - **add** (Set of String) - **drop** (Set of String) ### Nested Schema for `devices` Required: - **host_path** (String) Optional: - **container_path** (String) - **permissions** (String) ### Nested Schema for `healthcheck` Required: - **test** (List of String) The test to perform as list Optional: - **interval** (String) Time between running the check (ms|s|m|h) - **retries** (Number) Consecutive failures needed to report unhealthy - **start_period** (String) Start period for the container to initialize before counting retries towards unstable (ms|s|m|h) - **timeout** (String) Maximum time to allow one check to run (ms|s|m|h) ### Nested Schema for `host` Required: - **host** (String) - **ip** (String) ### Nested Schema for `labels` Required: - **label** (String) Name of the label - **value** (String) Value of the label ### Nested Schema for `mounts` Required: - **target** (String) Container path - **type** (String) The mount type Optional: - **bind_options** (Block List, Max: 1) Optional configuration for the bind type (see [below for nested schema](#nestedblock--mounts--bind_options)) - **read_only** (Boolean) Whether the mount should be read-only - **source** (String) Mount source (e.g. a volume name, a host path) - **tmpfs_options** (Block List, Max: 1) Optional configuration for the tmpfs type (see [below for nested schema](#nestedblock--mounts--tmpfs_options)) - **volume_options** (Block List, Max: 1) Optional configuration for the volume type (see [below for nested schema](#nestedblock--mounts--volume_options)) ### Nested Schema for `mounts.bind_options` Optional: - **propagation** (String) A propagation mode with the value ### Nested Schema for `mounts.tmpfs_options` Optional: - **mode** (Number) The permission mode for the tmpfs mount in an integer - **size_bytes** (Number) The size for the tmpfs mount in bytes ### Nested Schema for `mounts.volume_options` Optional: - **driver_name** (String) Name of the driver to use to create the volume - **driver_options** (Map of String) key/value map of driver specific options - **labels** (Block Set) User-defined key/value metadata (see [below for nested schema](#nestedblock--mounts--volume_options--labels)) - **no_copy** (Boolean) Populate volume with data from the target ### Nested Schema for `mounts.volume_options.labels` Required: - **label** (String) Name of the label - **value** (String) Value of the label ### Nested Schema for `networks_advanced` Required: - **name** (String) Optional: - **aliases** (Set of String) - **ipv4_address** (String) - **ipv6_address** (String) ### Nested Schema for `ports` Required: - **internal** (Number) Optional: - **external** (Number) - **ip** (String) - **protocol** (String) ### Nested Schema for `ulimit` Required: - **hard** (Number) - **name** (String) - **soft** (Number) ### Nested Schema for `upload` Required: - **file** (String) Optional: - **content** (String) - **content_base64** (String) - **executable** (Boolean) - **source** (String) - **source_hash** (String) ### Nested Schema for `volumes` Optional: - **container_path** (String) - **from_container** (String) - **host_path** (String) - **read_only** (Boolean) - **volume_name** (String) ### Nested Schema for `network_data` Read-Only: - **gateway** (String) - **global_ipv6_address** (String) - **global_ipv6_prefix_length** (Number) - **ip_address** (String) - **ip_prefix_length** (Number) - **ipv6_gateway** (String) - **network_name** (String)