DockerRunOptions

class aws_cdk.DockerRunOptions(*, command=None, entrypoint=None, environment=None, network=None, security_opt=None, user=None, volumes=None, volumes_from=None, working_directory=None)

Bases: object

Docker run options.

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

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

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

  • network (Optional[str]) – Docker Networking options. Default: - no networking options

  • security_opt (Optional[str]) – Security configuration when running the docker container. Default: - no security options

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

  • volumes (Optional[Sequence[Union[DockerVolume, Dict[str, Any]]]]) – Docker volumes to mount. Default: - no volumes are mounted

  • volumes_from (Optional[Sequence[str]]) – Where to mount the specified volumes from. Default: - no containers are specified to mount volumes from

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

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

docker_run_options = cdk.DockerRunOptions(
    command=["command"],
    entrypoint=["entrypoint"],
    environment={
        "environment_key": "environment"
    },
    network="network",
    security_opt="securityOpt",
    user="user",
    volumes=[cdk.DockerVolume(
        container_path="containerPath",
        host_path="hostPath",

        # the properties below are optional
        consistency=cdk.DockerVolumeConsistency.CONSISTENT
    )],
    volumes_from=["volumesFrom"],
    working_directory="workingDirectory"
)

Attributes

command

The command to run in the container.

Default
  • run the command defined in the image

entrypoint

The entrypoint to run in the container.

Default
  • run the entrypoint defined in the image

environment

The environment variables to pass to the container.

Default
  • no environment variables.

network

//docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network—network>`_.

Default
  • no networking options

Type

Docker `Networking options <https

security_opt

//docs.docker.com/engine/reference/run/#security-configuration>`_ when running the docker container.

Default
  • no security options

Type

`Security configuration <https

user

The user to use when running the container.

Default
  • root or image default

volumes

Docker volumes to mount.

Default
  • no volumes are mounted

volumes_from

Where to mount the specified volumes from.

Default
  • no containers are specified to mount volumes from

See

https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container—volumes-from

working_directory

Working directory inside the container.

Default
  • image default