Interface ContainerDefinitionOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
ContainerDefinitionProps
,FirelensLogRouterDefinitionOptions
,FirelensLogRouterProps
- All Known Implementing Classes:
ContainerDefinitionOptions.Jsii$Proxy
,ContainerDefinitionProps.Jsii$Proxy
,FirelensLogRouterDefinitionOptions.Jsii$Proxy
,FirelensLogRouterProps.Jsii$Proxy
TaskDefinition taskDefinition; Cluster cluster; // Add a container to the task definition ContainerDefinition specificContainer = taskDefinition.addContainer("Container", ContainerDefinitionOptions.builder() .image(ContainerImage.fromRegistry("/aws/aws-example-app")) .memoryLimitMiB(2048) .build()); // Add a port mapping specificContainer.addPortMappings(PortMapping.builder() .containerPort(7600) .protocol(Protocol.TCP) .build()); Ec2Service.Builder.create(this, "Service") .cluster(cluster) .taskDefinition(taskDefinition) .cloudMapOptions(CloudMapOptions.builder() // Create SRV records - useful for bridge networking .dnsRecordType(DnsRecordType.SRV) // Targets port TCP port 7600 `specificContainer` .container(specificContainer) .containerPort(7600) .build()) .build();
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forContainerDefinitionOptions
static final class
An implementation forContainerDefinitionOptions
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
The command that is passed to the container.default String
The name of the container.default Number
getCpu()
The minimum number of CPU units to reserve for the container.default Boolean
Specifies whether networking is disabled within the container.A list of DNS search domains that are presented to the container.A list of DNS servers that are presented to the container.A key/value map of labels to add to the container.A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.The ENTRYPOINT value to pass to the container.The environment variables to pass to the container.default List<EnvironmentFile>
The environment files to pass to the container.default Boolean
Specifies whether the container is marked essential.A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.default Number
The number of GPUs assigned to the container.default HealthCheck
The health check command and associated configuration parameters for the container.default String
The hostname to use for your container.getImage()
The image used to start a container.The inference accelerators referenced by the container.default LinuxParameters
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.default LogDriver
The log configuration specification for the container.default Number
The amount (in MiB) of memory to present to the container.default Number
The soft limit (in MiB) of memory to reserve for the container.default List<PortMapping>
The port mappings to add to the container definition.default Boolean
Specifies whether the container is marked as privileged.default Boolean
When this parameter is true, the container is given read-only access to its root file system.The secret environment variables to pass to the container.default Duration
Time duration (in seconds) to wait before giving up on resolving dependencies for a container.default Duration
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.default List<SystemControl>
A list of namespaced kernel parameters to set in the container.default String
getUser()
The user name to use inside the container.default String
The working directory in which to run commands inside the container.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getImage
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. TODO: Update these to specify using classes of IContainerImage
-
getCommand
The command that is passed to the container.If you provide a shell command as a single string, you have to quote command-line arguments.
Default: - CMD value built into container image.
-
getContainerName
The name of the container.Default: - id of node associated with ContainerDefinition.
-
getCpu
The minimum number of CPU units to reserve for the container.Default: - No minimum CPU units reserved.
-
getDisableNetworking
Specifies whether networking is disabled within the container.When this parameter is true, networking is disabled within the container.
Default: false
-
getDnsSearchDomains
A list of DNS search domains that are presented to the container.Default: - No search domains.
-
getDnsServers
A list of DNS servers that are presented to the container.Default: - Default DNS servers.
-
getDockerLabels
A key/value map of labels to add to the container.Default: - No labels.
-
getDockerSecurityOptions
A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.Default: - No security labels.
-
getEntryPoint
The ENTRYPOINT value to pass to the container.Default: - Entry point configured in container.
- See Also:
-
getEnvironment
The environment variables to pass to the container.Default: - No environment variables.
-
getEnvironmentFiles
The environment files to pass to the container.Default: - No environment files.
- See Also:
-
getEssential
Specifies whether the container is marked 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. 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. All tasks must have at least one essential container.
If this parameter is omitted, a container is assumed to be essential.
Default: true
-
getExtraHosts
A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.Default: - No extra hosts.
-
getGpuCount
The number of GPUs assigned to the container.Default: - No GPUs assigned.
-
getHealthCheck
The health check command and associated configuration parameters for the container.Default: - Health check configuration from container.
-
getHostname
The hostname to use for your container.Default: - Automatic hostname.
-
getInferenceAcceleratorResources
The inference accelerators referenced by the container.Default: - No inference accelerators assigned.
-
getLinuxParameters
Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.For more information see KernelCapabilities.
Default: - No Linux parameters.
-
getLogging
The log configuration specification for the container.Default: - Containers use the same logging driver that the Docker daemon uses.
-
getMemoryLimitMiB
The amount (in MiB) of memory to present to the container.If your container attempts to exceed the allocated memory, the container is terminated.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
Default: - No memory limit.
-
getMemoryReservationMiB
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.
At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services.
Default: - No memory reserved.
-
getPortMappings
The port mappings to add to the container definition.Default: - No ports are mapped.
-
getPrivileged
Specifies whether the container is marked as privileged.When this parameter is true, the container is given elevated privileges on the host container instance (similar to the root user).
Default: false
-
getReadonlyRootFilesystem
When this parameter is true, the container is given read-only access to its root file system.Default: false
-
getSecrets
The secret environment variables to pass to the container.Default: - No secret environment variables.
-
getStartTimeout
Time duration (in seconds) to wait before giving up on resolving dependencies for a container.Default: - none
-
getStopTimeout
Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own.Default: - none
-
getSystemControls
A list of namespaced kernel parameters to set in the container.Default: - No system controls are set.
- See Also:
-
getUser
The user name to use inside the container.Default: root
-
getWorkingDirectory
The working directory in which to run commands inside the container.Default: /
-
builder
- Returns:
- a
ContainerDefinitionOptions.Builder
ofContainerDefinitionOptions
-