Amazon Elastic Container Service TaskDefinition ContainerDefinition
The ContainerDefinition property type describes the configuration of an Amazon Elastic Container Service
(Amazon ECS) container. The container definitions are passed to the Docker daemon.
The ContainerDefinitions property of the AWS::ECS::TaskDefinition resource contains a list of ContainerDefinition property types.
Syntax
JSON
{ "Command" : [String, ...], "Cpu" :Integer, "DisableNetworking" :Boolean, "DnsSearchDomains" : [String, ...], "DnsServers" : [String, ...], "DockerLabels" : {String:String, ...}, "DockerSecurityOptions" : [String, ...], "EntryPoint" : [String, ...], "Environment" : [ KeyValuePair, ... ], "Essential" :Boolean, "ExtraHosts" : [ HostEntry, ... ], "HealthCheck" : HealthCheck, "Hostname" :String, "Image" :String, "Links" : [String, ...], "LinuxParameters" : LinuxParameters, "LogConfiguration" : LogConfiguration, "Memory" :Integer, "MemoryReservation" :Integer, "MountPoints" : [ MountPoint, ... ], "Name" :String, "PortMappings" : [ PortMapping, ... ], "Privileged" :Boolean, "ReadonlyRootFilesystem" :Boolean, "RepositoryCredentials" : RepositoryCredentials, "Ulimits" : [ Ulimit, ... ], "User" :String, "VolumesFrom" : [ VolumeFrom, ... ], "WorkingDirectory" :String}
YAML
Command: -StringCpu:IntegerDisableNetworking:BooleanDnsSearchDomains: -StringDnsServers: -StringDockerLabels:String:StringDockerSecurityOptions: -StringEntryPoint: -StringEnvironment: - KeyValuePair Essential:BooleanExtraHosts: - HostEntry HealthCheck: HealthCheck Hostname:StringImage:StringLinks: -StringLinuxParameters: LinuxParameters LogConfiguration: LogConfiguration Memory:IntegerMemoryReservation:IntegerMountPoints: - MountPoint Name:StringPortMappings: - PortMapping Privileged:BooleanReadonlyRootFilesystem:BooleanRepositoryCredentials: RepositoryCredentials Ulimits: - Ulimit User:StringVolumesFrom: - VolumeFrom WorkingDirectory:String
Properties
For more information about each property, see Task Definition Parameters in the Amazon Elastic Container Service Developer Guide.
Command-
The
CMDvalue to pass to the container. For more information about the DockerCMDparameter, see https://docs.docker.com/engine/reference/builder/#cmd.Required: No
Type: List of String values
Cpu-
The minimum number of CPU units to reserve for the container. Containers share unallocated CPU units with other containers on the instance by using the same ratio as their allocated CPU units. For more information, see the
cpucontent for the ContainerDefinition data type in the Amazon Elastic Container Service API Reference.Required: No
Type: Integer
DisableNetworking-
Indicates whether networking is disabled within the container.
Required: No
Type: Boolean
DnsSearchDomains-
A list of DNS search domains that are provided to the container. The domain names that the DNS logic looks up when a process attempts to access a bare unqualified hostname.
Required: No
Type: List of String values
DnsServers-
A list of DNS servers that Amazon ECS provides to the container.
Required: No
Type: List of String values
DockerLabels-
A key-value map of labels for the container.
Required: No
Type: Key-value pairs, with the name of the label as the key and the label value as the value.
DockerSecurityOptions-
A list of custom labels for SELinux and AppArmor multi-level security systems. For more information, see the
dockerSecurityOptionscontent for the ContainerDefinition data type in the Amazon Elastic Container Service API Reference.Required: No
Type: List of String values
EntryPoint-
The
ENTRYPOINTvalue to pass to the container. For more information about the DockerENTRYPOINTparameter, see https://docs.docker.com/engine/reference/builder/#entrypoint.Required: No
Type: List of String values
Environment-
The environment variables to pass to the container.
Required: No
Type: List of KeyValuePair property types
Essential-
Indicates whether the task stops if this container fails. If you specify
trueand the container fails, all other containers in the task stop. If you specifyfalseand the container fails, none of the other containers in the task is affected. This value istrueby default.You must have at least one essential container in a task.
Required: No
Type: Boolean
ExtraHosts-
A list of hostnames and IP address mappings to append to the
/etc/hostsfile on the container.Required: No
Type: List of HostEntry property types
HealthCheck-
A container health check. Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image (such as those specified in a parent image or from the image's Dockerfile).
Required: No
Type: HealthCheck
Hostname-
The name that Docker uses for the container hostname.
Required: No
Type: String
Image-
The image to use for a container. The image is passed directly to the Docker daemon. You can use images in the Docker Hub registry or specify other repositories (
repository-url/image:tag).Required: Yes
Type: String
Links-
The name of another container to connect to. With links, containers can communicate with each other without using port mappings.
Required: No
Type: List of String values
LinuxParameters-
The Linux-specific options that are applied to the container.
Required: No
Type: LinuxParameters
LogConfiguration-
Configures a custom log driver for the container. For more information, see the
logConfigurationcontent for the ContainerDefinition data type in the Amazon Elastic Container Service API Reference.Required: No
Type: LogConfiguration
Memory-
The hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the allocated memory, the container is terminated.
Required: Conditional. You must specify one or both of the
MemoryorMemoryReservationproperties. If you specify both, the value for theMemoryproperty must be greater than the value of theMemoryReservationproperty.Type: Integer
MemoryReservation-
The soft limit (in MiB) of memory to reserve for the container. When system memory is under contention, Docker attempts to keep the container memory within the limit. If the container requires more memory, it can consume up to the value specified by the
Memoryproperty or all of the available memory on the container instance—whichever comes first.Required: Conditional. You must specify one or both of the
MemoryorMemoryReservationproperties. If you specify both, the value for theMemoryproperty must be greater than the value of theMemoryReservationproperty.Type: Integer
MountPoints-
The mount points for data volumes in the container.
Required: No
Type: List of MountPoint property types
Name-
A name for the container.
Required: Yes
Type: String
PortMappings-
A mapping of the container port to a host port. Port mappings enable containers to access ports on the host container instance to send or receive traffic.
Required: No
Type: List of PortMapping property types
Privileged-
Indicates whether the container is given full access to the host container instance.
Required: No
Type: Boolean
ReadonlyRootFilesystem-
Indicates whether the container's root file system is mounted as read only.
Required: No
Type: Boolean
RepositoryCredentials-
The repository credentials for private registry authentication.
Required: No
Type: RepositoryCredentials
Ulimits-
A list of ulimits to set in the container. The ulimits set constraints on how many resources a container can consume so that it doesn't deplete all available resources on the host.
Required: No
Type: List of Ulimit property types
User-
The user name to use inside the container.
Required: No
Type: String
VolumesFrom-
The data volumes to mount from another container.
Required: No
Type: List of VolumeFrom property types
WorkingDirectory-
The working directory in the container to run commands in.
Required: No
Type: String
See Also
-
Task Definition Parameters in the Amazon Elastic Container Service Developer Guide
