# DockerImageSource

Properties for how to produce a Docker image from a source.

- Source: [`node_modules/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.d.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/node_modules/@aws-cdk/cloud-assembly-schema/lib/assets/docker-image-asset.d.ts#L26)
- Type last changed: v2.245.0 · 27 Mar 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
const dockerImageSource: cloud_assembly_schema.DockerImageSource = {
  cacheDisabled: false,
  cacheFrom: [{
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  }],
  cacheTo: {
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  directory: 'directory',
  dockerBuildArgs: {
    dockerBuildArgsKey: 'dockerBuildArgs',
  },
  dockerBuildContexts: {
    dockerBuildContextsKey: 'dockerBuildContexts',
  },
  dockerBuildSecrets: {
    dockerBuildSecretsKey: 'dockerBuildSecrets',
  },
  dockerBuildSsh: 'dockerBuildSsh',
  dockerBuildTarget: 'dockerBuildTarget',
  dockerFile: 'dockerFile',
  dockerOutputs: ['dockerOutputs'],
  executable: ['executable'],
  networkMode: 'networkMode',
  platform: 'platform',
};
```

## Properties

- `cacheDisabled`: boolean — Disable the cache and pass `--no-cache` to the `docker build` command.

  **Default:** cache is used

- `cacheFrom`: [DockerCacheOption](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.DockerCacheOption.html)[] — Cache from options to pass to the `docker build` command.

  **Default:** no cache from options are passed to the build command

- `cacheTo`: [DockerCacheOption](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.DockerCacheOption.html) — Cache to options to pass to the `docker build` command.

  **Default:** no cache to options are passed to the build command

- `directory`: string — The directory containing the Docker image build instructions.

  **Default:** Exactly one of `directory` and `executable` is required

  This path is relative to the asset manifest location.

- `dockerBuildArgs`: { [key: string]: string } — Additional build arguments.

  **Default:** No additional build arguments

  Only allowed when `directory` is set.

- `dockerBuildContexts`: { [key: string]: string } — Additional build contexts.

  **Default:** No additional build contexts

  Only allowed when `directory` is set.

- `dockerBuildSecrets`: { [key: string]: string } — Additional build secrets.

  **Default:** No additional build secrets

  Only allowed when `directory` is set.

- `dockerBuildSsh`: string — SSH agent socket or keys.

  **Default:** No ssh flag is set

  Requires building with docker buildkit.

- `dockerBuildTarget`: string — Target build stage in a Dockerfile with multiple build stages.

  **Default:** The last stage in the Dockerfile

  Only allowed when `directory` is set.

- `dockerFile`: string = "Dockerfile" — The name of the file with build instructions.

  Only allowed when `directory` is set.

- `dockerOutputs`: string[] — Outputs.

  **Default:** no outputs are passed to the build command (default outputs are used)

- `executable`: string[] — A command-line executable that returns the name of a local Docker image on stdout after being run.

  **Default:** Exactly one of `directory` and `executable` is required

- `networkMode`: string — Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.

  **Default:** no networking mode specified

  Specify this property to build images on a specific networking mode.

- `platform`: string — Platform to build for. _Requires Docker Buildx_.

  **Default:** current machine platform

  Specify this property to build images on a specific platform/architecture.
