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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.270Z") @Stability(Stable) public interface ContainerDefinitionOptions extends software.amazon.jsii.JsiiSerializable
Example:

 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();
 
  • Method Details

    • getImage

      @Stability(Stable) @NotNull ContainerImage 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

      @Stability(Stable) @Nullable default List<String> 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

      @Stability(Stable) @Nullable default String getContainerName()
      The name of the container.

      Default: - id of node associated with ContainerDefinition.

    • getCpu

      @Stability(Stable) @Nullable default Number getCpu()
      The minimum number of CPU units to reserve for the container.

      Default: - No minimum CPU units reserved.

    • getDisableNetworking

      @Stability(Stable) @Nullable default Boolean getDisableNetworking()
      Specifies whether networking is disabled within the container.

      When this parameter is true, networking is disabled within the container.

      Default: false

    • getDnsSearchDomains

      @Stability(Stable) @Nullable default List<String> getDnsSearchDomains()
      A list of DNS search domains that are presented to the container.

      Default: - No search domains.

    • getDnsServers

      @Stability(Stable) @Nullable default List<String> getDnsServers()
      A list of DNS servers that are presented to the container.

      Default: - Default DNS servers.

    • getDockerLabels

      @Stability(Stable) @Nullable default Map<String,String> getDockerLabels()
      A key/value map of labels to add to the container.

      Default: - No labels.

    • getDockerSecurityOptions

      @Stability(Stable) @Nullable default List<String> getDockerSecurityOptions()
      A list of strings to provide custom labels for SELinux and AppArmor multi-level security systems.

      Default: - No security labels.

    • getEntryPoint

      @Stability(Stable) @Nullable default List<String> getEntryPoint()
      The ENTRYPOINT value to pass to the container.

      Default: - Entry point configured in container.

      See Also:
    • getEnvironment

      @Stability(Stable) @Nullable default Map<String,String> getEnvironment()
      The environment variables to pass to the container.

      Default: - No environment variables.

    • getEnvironmentFiles

      @Stability(Stable) @Nullable default List<EnvironmentFile> getEnvironmentFiles()
      The environment files to pass to the container.

      Default: - No environment files.

      See Also:
    • getEssential

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default Map<String,String> getExtraHosts()
      A list of hostnames and IP address mappings to append to the /etc/hosts file on the container.

      Default: - No extra hosts.

    • getGpuCount

      @Stability(Stable) @Nullable default Number getGpuCount()
      The number of GPUs assigned to the container.

      Default: - No GPUs assigned.

    • getHealthCheck

      @Stability(Stable) @Nullable default HealthCheck getHealthCheck()
      The health check command and associated configuration parameters for the container.

      Default: - Health check configuration from container.

    • getHostname

      @Stability(Stable) @Nullable default String getHostname()
      The hostname to use for your container.

      Default: - Automatic hostname.

    • getInferenceAcceleratorResources

      @Stability(Stable) @Nullable default List<String> getInferenceAcceleratorResources()
      The inference accelerators referenced by the container.

      Default: - No inference accelerators assigned.

    • getLinuxParameters

      @Stability(Stable) @Nullable default LinuxParameters 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

      @Stability(Stable) @Nullable default LogDriver getLogging()
      The log configuration specification for the container.

      Default: - Containers use the same logging driver that the Docker daemon uses.

    • getMemoryLimitMiB

      @Stability(Stable) @Nullable default Number 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

      @Stability(Stable) @Nullable default Number 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

      @Stability(Stable) @Nullable default List<PortMapping> getPortMappings()
      The port mappings to add to the container definition.

      Default: - No ports are mapped.

    • getPrivileged

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default Boolean getReadonlyRootFilesystem()
      When this parameter is true, the container is given read-only access to its root file system.

      Default: false

    • getSecrets

      @Stability(Stable) @Nullable default Map<String,Secret> getSecrets()
      The secret environment variables to pass to the container.

      Default: - No secret environment variables.

    • getStartTimeout

      @Stability(Stable) @Nullable default Duration getStartTimeout()
      Time duration (in seconds) to wait before giving up on resolving dependencies for a container.

      Default: - none

    • getStopTimeout

      @Stability(Stable) @Nullable default Duration 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

      @Stability(Stable) @Nullable default List<SystemControl> getSystemControls()
      A list of namespaced kernel parameters to set in the container.

      Default: - No system controls are set.

      See Also:
    • getUser

      @Stability(Stable) @Nullable default String getUser()
      The user name to use inside the container.

      Default: root

    • getWorkingDirectory

      @Stability(Stable) @Nullable default String getWorkingDirectory()
      The working directory in which to run commands inside the container.

      Default: /

    • builder

      @Stability(Stable) static ContainerDefinitionOptions.Builder builder()
      Returns:
      a ContainerDefinitionOptions.Builder of ContainerDefinitionOptions