ContainerDefinition class

Container definitions are used in task definitions to describe the different containers that are launched as part of a task.

Constructors

ContainerDefinition({List<String>? command, int? cpu, List<ContainerDependency>? dependsOn, bool? disableNetworking, List<String>? dnsSearchDomains, List<String>? dnsServers, Map<String, String>? dockerLabels, List<String>? dockerSecurityOptions, List<String>? entryPoint, List<KeyValuePair>? environment, List<EnvironmentFile>? environmentFiles, bool? essential, List<HostEntry>? extraHosts, FirelensConfiguration? firelensConfiguration, HealthCheck? healthCheck, String? hostname, String? image, bool? interactive, List<String>? links, LinuxParameters? linuxParameters, LogConfiguration? logConfiguration, int? memory, int? memoryReservation, List<MountPoint>? mountPoints, String? name, List<PortMapping>? portMappings, bool? privileged, bool? pseudoTerminal, bool? readonlyRootFilesystem, RepositoryCredentials? repositoryCredentials, List<ResourceRequirement>? resourceRequirements, List<Secret>? secrets, int? startTimeout, int? stopTimeout, List<SystemControl>? systemControls, List<Ulimit>? ulimits, String? user, List<VolumeFrom>? volumesFrom, String? workingDirectory})
ContainerDefinition.fromJson(Map<String, dynamic> json)
factory

Properties

command List<String>?
The command that is passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/engine/reference/builder/#cmd. If there are multiple arguments, each argument should be a separated string in the array.
final
cpu int?
The number of cpu units reserved for the container. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run.
final
dependsOn List<ContainerDependency>?
The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed.
final
disableNetworking bool?
When this parameter is true, networking is disabled within the container. This parameter maps to NetworkDisabled in the Create a container section of the Docker Remote API.
final
dnsSearchDomains List<String>?
A list of DNS search domains that are presented to the container. This parameter maps to DnsSearch in the Create a container section of the Docker Remote API and the --dns-search option to docker run.
final
dnsServers List<String>?
A list of DNS servers that are presented to the container. This parameter maps to Dns in the Create a container section of the Docker Remote API and the --dns option to docker run.
final
dockerLabels Map<String, String>?
A key/value map of labels to add to the container. This parameter maps to Labels in the Create a container section of the Docker Remote API and the --label option to docker run. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'
final
dockerSecurityOptions List<String>?
A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems. This field is not valid for containers in tasks using the Fargate launch type.
final
entryPoint List<String>?
Entrypoint
final
environment List<KeyValuePair>?
The environment variables to pass to a container. This parameter maps to Env in the Create a container section of the Docker Remote API and the --env option to docker run.
final
environmentFiles List<EnvironmentFile>?
A list of files containing the environment variables to pass to a container. This parameter maps to the --env-file option to docker run.
final
essential bool?
If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false, then its failure does not affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.
final
extraHosts List<HostEntry>?
A list of hostnames and IP address mappings to append to the /etc/hosts file on the container. This parameter maps to ExtraHosts in the Create a container section of the Docker Remote API and the --add-host option to docker run.
final
firelensConfiguration FirelensConfiguration?
The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more information, see Custom Log Routing in the Amazon Elastic Container Service Developer Guide.
final
hashCode int
The hash code for this object.
no setterinherited
healthCheck HealthCheck?
The container health check command and associated configuration parameters for the container. This parameter maps to HealthCheck in the Create a container section of the Docker Remote API and the HEALTHCHECK parameter of docker run.
final
hostname String?
The hostname to use for your container. This parameter maps to Hostname in the Create a container section of the Docker Remote API and the --hostname option to docker run.
final
image String?
The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of docker run.
final
interactive bool?
When this parameter is true, this allows you to deploy containerized applications that require stdin or a tty to be allocated. This parameter maps to OpenStdin in the Create a container section of the Docker Remote API and the --interactive option to docker run.
final
The links parameter allows containers to communicate with each other without the need for port mappings. This parameter is only supported if the network mode of a task definition is bridge. The name:internalName construct is analogous to name:alias in Docker links. Up to 255 letters (uppercase and lowercase), numbers, and hyphens are allowed. For more information about linking Docker containers, go to Legacy container links in the Docker documentation. This parameter maps to Links in the Create a container section of the Docker Remote API and the --link option to docker run.
final
linuxParameters LinuxParameters?
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more information see KernelCapabilities.
final
logConfiguration LogConfiguration?
The log configuration specification for the container.
final
memory int?
The amount (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed. The total amount of memory reserved for all containers within a task must be lower than the task memory value, if one is specified. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run.
final
memoryReservation int?
The soft limit (in MiB) of memory to reserve for the container. When system memory is under heavy contention, Docker attempts to keep the container memory to this soft limit. However, your container can consume more memory when it needs to, up to either the hard limit specified with the memory parameter (if applicable), or all of the available memory on the container instance, whichever comes first. This parameter maps to MemoryReservation in the Create a container section of the Docker Remote API and the --memory-reservation option to docker run.
final
mountPoints List<MountPoint>?
The mount points for data volumes in your container.
final
name String?
The name of a container. If you are linking multiple containers together in a task definition, the name of one container can be entered in the links of another container to connect the containers. Up to 255 letters (uppercase and lowercase), numbers, and hyphens are allowed. This parameter maps to name in the Create a container section of the Docker Remote API and the --name option to docker run.
final
portMappings List<PortMapping>?
The list of port mappings for the container. Port mappings allow containers to access ports on the host container instance to send or receive traffic.
final
privileged bool?
When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run.
final
pseudoTerminal bool?
When this parameter is true, a TTY is allocated. This parameter maps to Tty in the Create a container section of the Docker Remote API and the --tty option to docker run.
final
readonlyRootFilesystem bool?
When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run.
final
repositoryCredentials RepositoryCredentials?
The private repository authentication credentials to use.
final
resourceRequirements List<ResourceRequirement>?
The type and amount of a resource to assign to a container. The only supported resource is a GPU.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secrets List<Secret>?
The secrets to pass to the container. For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide.
final
startTimeout int?
Time duration (in seconds) to wait before giving up on resolving dependencies for a container. For example, you specify two containers in a task definition with containerA having a dependency on containerB reaching a COMPLETE, SUCCESS, or HEALTHY status. If a startTimeout value is specified for containerB and it does not reach the desired status within that time then containerA will give up and not start. This results in the task transitioning to a STOPPED state. For tasks using the Fargate launch type, this parameter requires that the task or service uses platform version 1.3.0 or later.
final
stopTimeout int?
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.
final
systemControls List<SystemControl>?
A list of namespaced kernel parameters to set in the container. This parameter maps to Sysctls in the Create a container section of the Docker Remote API and the --sysctl option to docker run.
final
ulimits List<Ulimit>?
A list of ulimits to set in the container. If a ulimit value is specified in a task definition, it will override the default values set by Docker. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. Valid naming values are displayed in the Ulimit data type. This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'
final
user String?
The user to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run. You can specify the user using the following formats. If specifying a UID or GID, you must specify it as a positive integer.
final
volumesFrom List<VolumeFrom>?
Data volumes to mount from another container. This parameter maps to VolumesFrom in the Create a container section of the Docker Remote API and the --volumes-from option to docker run.
final
workingDirectory String?
The working directory in which to run commands inside the container. This parameter maps to WorkingDir in the Create a container section of the Docker Remote API and the --workdir option to docker run.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited