class NetworkMode
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Ecr.Assets.NetworkMode |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecrassets#NetworkMode |
Java | software.amazon.awscdk.services.ecr.assets.NetworkMode |
Python | aws_cdk.aws_ecr_assets.NetworkMode |
TypeScript (source) | aws-cdk-lib » aws_ecr_assets » NetworkMode |
networking mode on build time supported by docker.
Example
import { DockerImageAsset, NetworkMode } from 'aws-cdk-lib/aws-ecr-assets';
const asset = new DockerImageAsset(this, 'MyBuildImage', {
directory: path.join(__dirname, 'my-image'),
networkMode: NetworkMode.HOST,
})
Properties
| Name | Type | Description |
|---|---|---|
| mode | string | The networking mode to use for docker build. |
| static DEFAULT | Network | The default networking mode if omitted, create a network stack on the default Docker bridge. |
| static HOST | Network | Use the Docker host network stack. |
| static NONE | Network | Disable the network stack, only the loopback device will be created. |
mode
Type:
string
The networking mode to use for docker build.
static DEFAULT
Type:
Network
The default networking mode if omitted, create a network stack on the default Docker bridge.
static HOST
Type:
Network
Use the Docker host network stack.
static NONE
Type:
Network
Disable the network stack, only the loopback device will be created.
Methods
| Name | Description |
|---|---|
| static custom(mode) | Used to specify a custom networking mode Use this if the networking mode name is not yet supported by the CDK. |
| static from | Reuse another container's network stack. |
static custom(mode)
public static custom(mode: string): NetworkMode
Parameters
- mode
string— The networking mode to use for docker build.
Returns
Used to specify a custom networking mode Use this if the networking mode name is not yet supported by the CDK.
static fromContainer(containerId)
public static fromContainer(containerId: string): NetworkMode
Parameters
- containerId
string— The target container's id or name.
Returns
Reuse another container's network stack.

.NET
Go
Java
Python
TypeScript (