Configuring a Container definition

The Amazon ECS wizard gets started. A diagram of ECS objects gets displayed, as shown in Chapter 1Getting Started with Amazon ECS and Amazon Fargate. By default, the Fargate launch type is used. First, the container definition is to be defined, followed by the task definition. 

A Task definition consists of one or more container definitions. Most of the attributes are defined in the container definition, but a few are defined at the task level. To start with, select a container definition template, including the image, from one of those listed, which include sample-app and nginx, or create a custom container definition.

  • Click on Configure for the custom container definition, as shown in the following screenshot, to create a new custom container definition:
  • The Edit container dialog gets displayed. The standard configuration for a container includes the fields discussed in the following table:
Field Description
Container name The name of the Docker container to be created.
Image The Docker image.
Port mappings Container port mappings. Host port mappings are not supported with Fargate and default to the same value as the container port mappings.
  • Specify a Container name (hello-world). Click on the i icon to display a callout for the container name. The container name must be up to 255 characters (uppercase and lowercase, numbers, hyphens, and underscores).
  • Next, specify a Docker Image (tutum/hello-world). The image name must be up to 255 characters (uppercase and lowercase, numbers, hyphens, underscores, colons, periods, /, and number signs). The Fargate launch type only supports images in the Amazon ECR or public repositories in Docker Hub.
  • Next, specify the Memory Limits in MiB. Two memory limits may be specified: Soft limit and Hard limit. Either or both may be specified. The effect of specifying one or both is discussed in this table:
Memory types configured
Description
Soft limit only

ECS reserves the specified amount of memory (memoryReservation) for the container. The container may request more memory in excess of the soft limit up to all of the memory that is available on the container instance.

Hard limit only The memory requested by the container cannot exceed the hard limit.
Both Soft limit and Hard limit

ECS reserves a specified amount of memory (memoryReservation) for the container. The container may request more memory in excess of the soft limit up to the hard limit if specified, or all of the memory that is available on the container instance, whichever it reaches first. If both are specified, the Hard limit must be greater or the same as the Soft limit.

  • The dropdown for the Memory Limits lists both the Hard Limit and the Soft limit. The Soft limit default value, is 128 MiB. To add a hard limit on memory in addition to a soft limit, click on the Add Hard Limit link. A Hard limit gets added. Memory Limits are shown as follows. The Soft limit (128 MiB) is less than the Hard limit (256 MiB):
  • Next, specify the Port mappings. With the Fargate launch type, exposed ports must be specified as container ports. Container port 80 is specified as follows. The host port is the same as the Container port by default, and cannot be set to a different value with the awsvpc network mode that the Fargate launch type uses:
  • Optionally, specify Advanced container configuration, which consists of configuration for Environment, Network settings, Storage & Logging, Resource Limits, and Docker Labels. While the memory and CPU configuration is required at the task definition level, it is optional at the container level. The only requirement is that the total amount of memory for all containers within a task must not exceed the memory configured for the task, and the total amount of CPU for all containers within a task must not exceed the CPU configured for the task. A container instance has 1,024 CPU units for every CPU core. If the Essential checkbox for a container is checked, the failure of the container returns in the entire task failing. At least one container in a task must be set as the essential container, which implies that if a task has only one container, it must be essential, as shown here:
  • The only network mode supported by the Fargate launch type is awsvpc. The only supported log configuration and log driver for the Fargate launch type is awslogs. Click on Update after configuring the custom container, shown as follows:
  • A Container definition for the hello-world custom container gets added as follows:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.240.119