# NetworkMode

networking mode on build time supported by docker.

- Source: [`aws-ecr-assets/lib/image-asset.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecr-assets/lib/image-asset.ts#L16)
- Type last changed: v2.11.0 · 8 Feb 2022

## Example

```ts
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

- `DEFAULT`: [NetworkMode](/cdk/api/v2/docs/aws-cdk-lib.aws_ecr_assets.NetworkMode.html) (required) (static) — The default networking mode if omitted, create a network stack on the default Docker bridge.

- `HOST`: [NetworkMode](/cdk/api/v2/docs/aws-cdk-lib.aws_ecr_assets.NetworkMode.html) (required) (static) — Use the Docker host network stack.

- `mode`: string (required) — The networking mode to use for docker build.

- `NONE`: [NetworkMode](/cdk/api/v2/docs/aws-cdk-lib.aws_ecr_assets.NetworkMode.html) (required) (static) — Disable the network stack, only the loopback device will be created.

## Methods

- `custom(mode: string): NetworkMode // chainable` (static) — Used to specify a custom networking mode Use this if the networking mode name is not yet supported by the CDK.

  **Parameters**

  - `mode` — The networking mode to use for docker build.

- `fromContainer(containerId: string): NetworkMode // chainable` (static) — Reuse another container's network stack.

  **Parameters**

  - `containerId` — The target container's id or name.
