# ContainerProperty

Struct · External

`Container` is a property of the [ContainerServiceDeployment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-container-containerservicedeployment.html) property. It describes the settings of a container that will be launched, or that is launched, to an Amazon Lightsail container service.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const containerProperty: lightsail.CfnContainer.ContainerProperty = {
  command: ['command'],
  containerName: 'containerName',
  environment: [{
    value: 'value',
    variable: 'variable',
  }],
  image: 'image',
  ports: [{
    port: 'port',
    protocol: 'protocol',
  }],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

container_property = lightsail.CfnContainer.ContainerProperty(
    command=["command"],
    container_name="containerName",
    environment=[lightsail.CfnContainer.EnvironmentVariableProperty(
        value="value",
        variable="variable"
    )],
    image="image",
    ports=[lightsail.CfnContainer.PortInfoProperty(
        port="port",
        protocol="protocol"
    )]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

ContainerProperty containerProperty = ContainerProperty.builder()
        .command(List.of("command"))
        .containerName("containerName")
        .environment(List.of(EnvironmentVariableProperty.builder()
                .value("value")
                .variable("variable")
                .build()))
        .image("image")
        .ports(List.of(PortInfoProperty.builder()
                .port("port")
                .protocol("protocol")
                .build()))
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var containerProperty = new ContainerProperty {
    Command = new [] { "command" },
    ContainerName = "containerName",
    Environment = new [] { new EnvironmentVariableProperty {
        Value = "value",
        Variable = "variable"
    } },
    Image = "image",
    Ports = new [] { new PortInfoProperty {
        Port = "port",
        Protocol = "protocol"
    } }
};
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

containerProperty := &ContainerProperty{
	Command: []*string{
		jsii.String("command"),
	},
	ContainerName: jsii.String("containerName"),
	Environment: []interface{}{
		&EnvironmentVariableProperty{
			Value: jsii.String("value"),
			Variable: jsii.String("variable"),
		},
	},
	Image: jsii.String("image"),
	Ports: []interface{}{
		&PortInfoProperty{
			Port: jsii.String("port"),
			Protocol: jsii.String("protocol"),
		},
	},
}
```

## Properties

- `command`: string[] — The launch command for the container.

- `containerName`: string — The name of the container.

- `environment`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnContainer.EnvironmentVariableProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnContainer.EnvironmentVariableProperty.html)[] — The environment variables of the container.

- `image`: string — The name of the image used for the container.

  Container images that are sourced from (registered and stored on) your container service start with a colon ( `:` ). For example, if your container service name is `container-service-1` , the container image label is `mystaticsite` , and you want to use the third version ( `3` ) of the registered container image, then you should specify `:container-service-1.mystaticsite.3` . To use the latest version of a container image, specify `latest` instead of a version number (for example, `:container-service-1.mystaticsite.latest` ). Your container service will automatically use the highest numbered version of the registered container image.

  Container images that are sourced from a public registry like Docker Hub don’t start with a colon. For example, `nginx:latest` or `nginx` .

- `ports`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnContainer.PortInfoProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnContainer.PortInfoProperty.html)[] — An object that describes the open firewall ports and protocols of the container.
