Interface CfnDaemonTaskDefinition.IDaemonContainerDefinitionProperty
A container definition for a daemon task.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface CfnDaemonTaskDefinition.IDaemonContainerDefinitionProperty
Syntax (vb)
Public Interface CfnDaemonTaskDefinition.IDaemonContainerDefinitionProperty
Remarks
Daemon container definitions describe the containers that run as part of a daemon task on container instances managed by capacity providers.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;
var daemonContainerDefinitionProperty = new DaemonContainerDefinitionProperty {
Image = "image",
Name = "name",
// the properties below are optional
Command = new [] { "command" },
Cpu = 123,
DependsOn = new [] { new ContainerDependencyProperty {
Condition = "condition",
ContainerName = "containerName"
} },
EntryPoint = new [] { "entryPoint" },
Environment = new [] { new KeyValuePairProperty {
Name = "name",
Value = "value"
} },
EnvironmentFiles = new [] { new EnvironmentFileProperty {
Type = "type",
Value = "value"
} },
Essential = false,
FirelensConfiguration = new FirelensConfigurationProperty {
Options = new Dictionary<string, string> {
{ "optionsKey", "options" }
},
Type = "type"
},
HealthCheck = new HealthCheckProperty {
Command = new [] { "command" },
Interval = 123,
Retries = 123,
StartPeriod = 123,
Timeout = 123
},
Interactive = false,
LinuxParameters = new LinuxParametersProperty {
Capabilities = new KernelCapabilitiesProperty {
Add = new [] { "add" },
Drop = new [] { "drop" }
},
Devices = new [] { new DeviceProperty {
ContainerPath = "containerPath",
HostPath = "hostPath",
Permissions = new [] { "permissions" }
} },
InitProcessEnabled = false,
Tmpfs = new [] { new TmpfsProperty {
Size = 123,
// the properties below are optional
ContainerPath = "containerPath",
MountOptions = new [] { "mountOptions" }
} }
},
LogConfiguration = new LogConfigurationProperty {
LogDriver = "logDriver",
// the properties below are optional
Options = new Dictionary<string, string> {
{ "optionsKey", "options" }
},
SecretOptions = new [] { new SecretProperty {
Name = "name",
ValueFrom = "valueFrom"
} }
},
Memory = 123,
MemoryReservation = 123,
MountPoints = new [] { new MountPointProperty {
ContainerPath = "containerPath",
ReadOnly = false,
SourceVolume = "sourceVolume"
} },
Privileged = false,
PseudoTerminal = false,
ReadonlyRootFilesystem = false,
RepositoryCredentials = new RepositoryCredentialsProperty {
CredentialsParameter = "credentialsParameter"
},
RestartPolicy = new RestartPolicyProperty {
Enabled = false,
IgnoredExitCodes = new [] { 123 },
RestartAttemptPeriod = 123
},
Secrets = new [] { new SecretProperty {
Name = "name",
ValueFrom = "valueFrom"
} },
StartTimeout = 123,
StopTimeout = 123,
SystemControls = new [] { new SystemControlProperty {
Namespace = "namespace",
Value = "value"
} },
Ulimits = new [] { new UlimitProperty {
HardLimit = 123,
Name = "name",
SoftLimit = 123
} },
User = "user",
WorkingDirectory = "workingDirectory"
};
Synopsis
Properties
| Command | The command that's passed to the container. |
| Cpu | The number of |
| DependsOn | The dependencies defined for container startup and shutdown. |
| EntryPoint | The entry point that's passed to the container. |
| Environment | The environment variables to pass to a container. |
| EnvironmentFiles | A list of files containing the environment variables to pass to a container. |
| Essential | If the |
| FirelensConfiguration | The FireLens configuration for the container. |
| HealthCheck | An object representing a container health check. |
| Image | The image used to start the container. |
| Interactive | When this parameter is |
| LinuxParameters | The Linux-specific options that are applied to the container, such as Linux KernelCapabilities. |
| LogConfiguration | The log configuration for the container. |
| Memory | The amount (in MiB) of memory to present to the container. |
| MemoryReservation | The soft limit (in MiB) of memory to reserve for the container. |
| MountPoints | The mount points for data volumes in your container. |
| Name | The name of the container. |
| Privileged | When this parameter is true, the container is given elevated privileges on the host container instance (similar to the |
| PseudoTerminal | When this parameter is |
| ReadonlyRootFilesystem | When this parameter is true, the container is given read-only access to its root file system. |
| RepositoryCredentials | The repository credentials for private registry authentication. |
| RestartPolicy | A container definition for a daemon task. |
| Secrets | The secrets to pass to the container. |
| StartTimeout | Time duration (in seconds) to wait before giving up on resolving dependencies for a container. |
| StopTimeout | Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own. |
| SystemControls | A list of namespaced kernel parameters to set in the container. |
| Ulimits | A list of |
| User | The user to use inside the container. |
| WorkingDirectory | The working directory to run commands inside the container in. |
Properties
Command
The command that's passed to the container.
string[]? Command { get; }
Property Value
string[]
Remarks
Cpu
The number of cpu units reserved for the container.
double? Cpu { get; }
Property Value
Remarks
DependsOn
The dependencies defined for container startup and shutdown.
object? DependsOn { get; }
Property Value
Remarks
A container can contain multiple dependencies on other containers in a task definition.
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.IContainerDependencyProperty)[]
EntryPoint
The entry point that's passed to the container.
string[]? EntryPoint { get; }
Property Value
string[]
Remarks
Environment
The environment variables to pass to a container.
object? Environment { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.IKeyValuePairProperty)[]
EnvironmentFiles
A list of files containing the environment variables to pass to a container.
object? EnvironmentFiles { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.IEnvironmentFileProperty)[]
Essential
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.
object? Essential { get; }
Property Value
Remarks
FirelensConfiguration
The FireLens configuration for the container.
object? FirelensConfiguration { get; }
Property Value
Remarks
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.
Type union: either IResolvable or CfnDaemonTaskDefinition.IFirelensConfigurationProperty
HealthCheck
An object representing a container health check.
object? HealthCheck { get; }
Property Value
Remarks
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). This configuration maps to the HEALTHCHECK parameter of docker run.
The Amazon ECS container agent only monitors and reports on the health checks specified in the task definition. Amazon ECS does not monitor Docker health checks that are embedded in a container image and not specified in the container definition. Health check parameters that are specified in a container definition override any Docker health checks that exist in the container image.
You can view the health status of both individual containers and a task with the DescribeTasks API operation or when viewing the task details in the console.
The health check is designed to make sure that your containers survive agent restarts, upgrades, or temporary unavailability.
Amazon ECS performs health checks on containers with the default that launched the container instance or the task.
The following describes the possible healthStatus values for a container:
The following describes the possible healthStatus values based on the container health checker status of essential containers in the task with the following priority order (high to low):
Consider the following task health example with 2 containers.
Consider the following task health example with 3 containers.
If a task is run manually, and not as part of a service, the task will continue its lifecycle regardless of its health status. For tasks that are part of a service, if the task reports as unhealthy then the task will be stopped and the service scheduler will replace it. When a container health check fails for a task that is part of a service, the following process occurs:
For more detailed information about task lifecycle states, see Task lifecycle in the Amazon Elastic Container Service Developer Guide. The following are notes about container health check support:
For an example of how to specify a task definition with multiple containers where container dependency is specified, see Container dependency in the Amazon Elastic Container Service Developer Guide.
Type union: either IResolvable or CfnDaemonTaskDefinition.IHealthCheckProperty
Image
The image used to start the container.
string Image { get; }
Property Value
Remarks
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.
Interactive
When this parameter is true, you can deploy containerized applications that require stdin or a tty to be allocated.
object? Interactive { get; }
Property Value
Remarks
LinuxParameters
The Linux-specific options that are applied to the container, such as Linux KernelCapabilities.
object? LinuxParameters { get; }
Property Value
Remarks
LogConfiguration
The log configuration for the container.
object? LogConfiguration { get; }
Property Value
Remarks
This parameter maps to LogConfig in the docker container create command and the --log-driver option to docker run.
By default, containers use the same logging driver that the Docker daemon uses. However, the container might use a different logging driver than the Docker daemon by specifying a log driver configuration in the container definition.
Understand the following when specifying a log configuration for your containers.
Type union: either IResolvable or CfnDaemonTaskDefinition.ILogConfigurationProperty
Memory
The amount (in MiB) of memory to present to the container.
double? Memory { get; }
Property Value
Remarks
If the container attempts to exceed the memory specified here, the container is killed.
MemoryReservation
The soft limit (in MiB) of memory to reserve for the container.
double? MemoryReservation { get; }
Property Value
Remarks
MountPoints
The mount points for data volumes in your container.
object? MountPoints { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.IMountPointProperty)[]
Name
The name of the container.
string Name { get; }
Property Value
Remarks
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.
Privileged
When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).
object? Privileged { get; }
Property Value
Remarks
PseudoTerminal
When this parameter is true, a TTY is allocated.
object? PseudoTerminal { get; }
Property Value
Remarks
ReadonlyRootFilesystem
When this parameter is true, the container is given read-only access to its root file system.
object? ReadonlyRootFilesystem { get; }
Property Value
Remarks
RepositoryCredentials
The repository credentials for private registry authentication.
object? RepositoryCredentials { get; }
Property Value
Remarks
Type union: either IResolvable or CfnDaemonTaskDefinition.IRepositoryCredentialsProperty
RestartPolicy
A container definition for a daemon task.
object? RestartPolicy { get; }
Property Value
Remarks
Secrets
The secrets to pass to the container.
object? Secrets { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.ISecretProperty)[]
StartTimeout
Time duration (in seconds) to wait before giving up on resolving dependencies for a container.
double? StartTimeout { get; }
Property Value
Remarks
StopTimeout
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.
double? StopTimeout { get; }
Property Value
Remarks
SystemControls
A list of namespaced kernel parameters to set in the container.
object? SystemControls { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.ISystemControlProperty)[]
Ulimits
A list of ulimits to set in the container.
object? Ulimits { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnDaemonTaskDefinition.IUlimitProperty)[]
User
The user to use inside the container.
string? User { get; }
Property Value
Remarks
WorkingDirectory
The working directory to run commands inside the container in.
string? WorkingDirectory { get; }