aws-cdk-lib.aws_ecr_assets.NetworkMode

class NetworkMode

LanguageType name
.NETAmazon.CDK.AWS.Ecr.Assets.NetworkMode
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecrassets#NetworkMode
Javasoftware.amazon.awscdk.services.ecr.assets.NetworkMode
Pythonaws_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

NameTypeDescription
modestringThe networking mode to use for docker build.
static DEFAULTNetworkModeThe default networking mode if omitted, create a network stack on the default Docker bridge.
static HOSTNetworkModeUse the Docker host network stack.
static NONENetworkModeDisable the network stack, only the loopback device will be created.

mode

Type: string

The networking mode to use for docker build.


static DEFAULT

Type: NetworkMode

The default networking mode if omitted, create a network stack on the default Docker bridge.


static HOST

Type: NetworkMode

Use the Docker host network stack.


static NONE

Type: NetworkMode

Disable the network stack, only the loopback device will be created.

Methods

NameDescription
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 fromContainer(containerId)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

  • NetworkMode

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

  • NetworkMode

Reuse another container's network stack.