BundlingDockerImage

class aws_cdk.core.BundlingDockerImage(*args, **kwargs)

Bases: object

A Docker image used for asset bundling.

Methods

cp(image_path, output_path)

Copies a file or directory out of the Docker image to the local filesystem.

Parameters
  • image_path (str) –

  • output_path (str) –

Return type

None

run(*, command=None, environment=None, user=None, volumes=None, working_directory=None)

Runs a Docker image.

Parameters
  • command (Optional[List[str]]) – The command to run in the container. Default: - run the command defined in the image

  • environment (Optional[Mapping[str, str]]) – The environment variables to pass to the container. Default: - no environment variables.

  • user (Optional[str]) – The user to use when running the container. Default: - root or image default

  • volumes (Optional[List[DockerVolume]]) – Docker volumes to mount. Default: - no volumes are mounted

  • working_directory (Optional[str]) – Working directory inside the container. Default: - image default

Return type

None

to_json()

Provides a stable representation of this image for JSON serialization.

Return type

str

Returns

The overridden image name if set or image hash name in that order

Attributes

image

The Docker image.

Return type

str

Static Methods

classmethod from_asset(path, *, build_args=None, file=None)

Reference an image that’s built directly from sources on disk.

Parameters
  • path (str) – The path to the directory containing the Docker file.

  • build_args (Optional[Mapping[str, str]]) – Build args. Default: - no build args

  • file (Optional[str]) – Name of the Dockerfile. Default: - The Dockerfile immediately within the build context path

Return type

BundlingDockerImage

classmethod from_registry(image)

Reference an image on DockerHub or another online registry.

Parameters

image (str) – the image name.

Return type

BundlingDockerImage