TaskContainerPropertiesProperty Struct
Container properties are used for Amazon ECS-based job definitions.
These properties to describe the container that's launched as part of a job.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_batch as batch } from 'aws-cdk-lib';
declare const options: any;
const taskContainerPropertiesProperty: batch.CfnJobDefinition.TaskContainerPropertiesProperty = {
image: 'image',
// the properties below are optional
command: ['command'],
dependsOn: [{
condition: 'condition',
containerName: 'containerName',
}],
environment: [{
name: 'name',
value: 'value',
}],
essential: false,
firelensConfiguration: {
type: 'type',
// the properties below are optional
options: {
optionsKey: 'options',
},
},
linuxParameters: {
devices: [{
containerPath: 'containerPath',
hostPath: 'hostPath',
permissions: ['permissions'],
}],
initProcessEnabled: false,
maxSwap: 123,
sharedMemorySize: 123,
swappiness: 123,
tmpfs: [{
containerPath: 'containerPath',
size: 123,
// the properties below are optional
mountOptions: ['mountOptions'],
}],
},
logConfiguration: {
logDriver: 'logDriver',
// the properties below are optional
options: options,
secretOptions: [{
name: 'name',
valueFrom: 'valueFrom',
}],
},
mountPoints: [{
containerPath: 'containerPath',
readOnly: false,
sourceVolume: 'sourceVolume',
}],
name: 'name',
privileged: false,
readonlyRootFilesystem: false,
repositoryCredentials: {
credentialsParameter: 'credentialsParameter',
},
resourceRequirements: [{
type: 'type',
value: 'value',
}],
secrets: [{
name: 'name',
valueFrom: 'valueFrom',
}],
startTimeout: 123,
stopTimeout: 123,
ulimits: [{
hardLimit: 123,
name: 'name',
softLimit: 123,
}],
user: 'user',
};
Properties
notes
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 Dockerfile reference: CMD .
dependsOnIResolvable | IResolvable | CfnJobDefinition.TaskContainerDependencyProperty[]depends_ontyping.Union[IResolvable, typing.List[typing.Union[IResolvable, TaskContainerDependencyProperty]]]dependsOnIResolvableDependsOnIResolvableDependsOninterface{}#environmentIResolvable | IResolvable | CfnJobDefinition.EnvironmentProperty[]environmenttyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EnvironmentProperty]]]environmentIResolvableEnvironmentIResolvableEnvironmentinterface{}#notes
This parameter maps to Env in the Create a container section of the Docker Remote API and the --env parameter to docker run .
We don't recommend using plaintext environment variables for sensitive information, such as credential data. > Environment variables cannot start with
AWS_BATCH. This naming convention is reserved for variables that AWS Batch sets.
essentialboolean | IResolvableessentialtyping.Union[bool, IResolvable]essentialBooleanEssentialboolEssentialinterface{}#notes
If the essential parameter of a container is marked as false, its failure doesn't affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.
All jobs must have at least one essential container. If you have an application that's composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide .
firelensConfigurationIResolvable | CfnJobDefinition.FirelensConfigurationPropertyfirelens_configurationtyping.Union[IResolvable, FirelensConfigurationProperty]firelensConfigurationIResolvableFirelensConfigurationIResolvableFirelensConfigurationinterface{}#notes
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 .
notes
This string is passed directly to the Docker daemon. By default, images in the Docker Hub registry are available. 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 the docker run .
linuxParametersIResolvable | CfnJobDefinition.LinuxParametersPropertylinux_parameterstyping.Union[IResolvable, LinuxParametersProperty]linuxParametersIResolvableLinuxParametersIResolvableLinuxParametersinterface{}#For more information, see KernelCapabilities .
logConfigurationIResolvable | CfnJobDefinition.LogConfigurationPropertylog_configurationtyping.Union[IResolvable, LogConfigurationProperty]logConfigurationIResolvableLogConfigurationIResolvableLogConfigurationinterface{}#notes
This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run .
By default, containers use the same logging driver that the Docker daemon uses. However the container can use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information about the options for different supported log drivers, see Configure logging drivers in the Docker documentation .
Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the
LogConfigurationdata type). Additional log drivers may be available in future releases of the Amazon ECS container agent.
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}}'
The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the
ECS_AVAILABLE_LOGGING_DRIVERSenvironment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide .
mountPointsIResolvable | IResolvable | CfnJobDefinition.MountPointProperty[]mount_pointstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MountPointProperty]]]mountPointsIResolvableMountPointsIResolvableMountPointsinterface{}#notes
This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run .
Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can't mount directories on a different drive, and mount point can't be across drives.
The name can be used as a unique identifier to target your dependsOn and Overrides objects.
privilegedboolean | IResolvableprivilegedtyping.Union[bool, IResolvable]privilegedBooleanPrivilegedboolPrivilegedinterface{}#notes
This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run .
This parameter is not supported for Windows containers or tasks run on Fargate.
readonlyRootFilesystemboolean | IResolvablereadonly_root_filesystemtyping.Union[bool, IResolvable]readonlyRootFilesystemBooleanReadonlyRootFilesystemboolReadonlyRootFilesysteminterface{}#notes
This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .
This parameter is not supported for Windows containers.
repositoryCredentialsIResolvable | CfnJobDefinition.RepositoryCredentialsPropertyrepository_credentialstyping.Union[IResolvable, RepositoryCredentialsProperty]repositoryCredentialsIResolvableRepositoryCredentialsIResolvableRepositoryCredentialsinterface{}#resourceRequirementsIResolvable | IResolvable | CfnJobDefinition.ResourceRequirementProperty[]resource_requirementstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ResourceRequirementProperty]]]resourceRequirementsIResolvableResourceRequirementsIResolvableResourceRequirementsinterface{}#The only supported resource is a GPU.
secretsIResolvable | IResolvable | CfnJobDefinition.SecretProperty[]secretstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, SecretProperty]]]secretsIResolvableSecretsIResolvableSecretsinterface{}#For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide.
ulimitsIResolvable | IResolvable | CfnJobDefinition.UlimitProperty[]ulimitstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, UlimitProperty]]]ulimitsIResolvableUlimitsIResolvableUlimitsinterface{}#notes
If a ulimit value is specified in a task definition, it overrides 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 .
Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception of the nofile resource limit parameter which Fargate overrides. The nofile resource limit sets a restriction on the number of open files that a container can use. The default nofile soft limit is 1024 and the default hard limit is 65535 .
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}}'
This parameter is not supported for Windows containers.
notes
This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.
When running tasks using the
hostnetwork mode, don't run containers using theroot user (UID 0). We recommend using a non-root user for better security.
You can specify the user using the following formats. If specifying a UID or GID, you must specify it as a positive integer.
useruser:groupuiduid:giduser:giuid:group
This parameter is not supported for Windows containers.