DockerImage
A Docker image.
Initializers
import ros_cdk_core
ros_cdk_core.DockerImage(
image: str,
_imagehash: str = None
)
Name | Type | Description |
---|---|---|
image |
str |
No description. |
_imagehash |
str |
No description. |
image
Required
- Type: str
_imagehash
Optional
- Type: str
Methods
Name | Description |
---|---|
cp |
Copies a file or directory out of the Docker image to the local filesystem. |
run |
Runs a Docker image. |
to_jso_n |
Provides a stable representation of this image for JSON serialization. |
cp
def cp(
image_path: str,
output_path: str = None
) -> str
Copies a file or directory out of the Docker image to the local filesystem.
If outputPath
is omitted the destination path is a temporary directory.
- Type: str
the path in the Docker image.
- Type: str
the destination path for the copy operation.
run
def run(
command: typing.List[str] = None,
entrypoint: typing.List[str] = None,
environment: typing.Mapping[str] = None,
network: str = None,
platform: str = None,
security_opt: str = None,
user: str = None,
volumes: typing.List[DockerVolume] = None,
volumes_from: typing.List[str] = None,
working_directory: str = None
) -> None
Runs a Docker image.
- Type: typing.List[str]
- Default: run the command defined in the image
The command to run in the container.
- Type: typing.List[str]
- Default: run the entrypoint defined in the image
The entrypoint to run in the container.
- Type: typing.Mapping[str]
- Default: no environment variables.
The environment variables to pass to the container.
- Type: str
- Default: no networking options
Docker Networking options.
- Type: str
- Default: no platform specified
Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.
Example value: linux/amd64
- Type: str
- Default: no security options
Security configuration when running the docker container.
- Type: str
- Default: root or image default
The user to use when running the container.
- Type: typing.List[DockerVolume]
- Default: no volumes are mounted
Docker volumes to mount.
- Type: typing.List[str]
- Default: no containers are specified to mount volumes from
Where to mount the specified volumes from.
- Type: str
- Default: image default
Working directory inside the container.
to_jso_n
def to_jso_n() -> str
Provides a stable representation of this image for JSON serialization.
Static Functions
Name | Description |
---|---|
from_build |
Builds a Docker image. |
from_registry |
Reference an image on DockerHub or another online registry. |
from_build
import ros_cdk_core
ros_cdk_core.DockerImage.from_build(
path: str,
build_args: typing.Mapping[str] = None,
cache_disabled: bool = None,
cache_from: typing.List[DockerCacheOption] = None,
cache_to: DockerCacheOption = None,
file: str = None,
platform: str = None,
target_stage: str = None
)
Builds a Docker image.
- Type: str
The path to the directory containing the Docker file.
- Type: typing.Mapping[str]
- Default: no build args
Build args.
- Type: bool
- Default: cache is used
Disable the cache and pass --no-cache
to the docker build
command.
- Type: typing.List[DockerCacheOption]
- Default: no cache from args are passed
Cache from options to pass to the docker build
command.
- Type: DockerCacheOption
- Default: no cache to args are passed
Cache to options to pass to the docker build
command.
- Type: str
- Default:
Dockerfile
Name of the Dockerfile, must relative to the docker build path.
- Type: str
- Default: no platform specified
Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+.
Example value: linux/amd64
- Type: str
- Default: Build all stages defined in the Dockerfile
Set build target for multi-stage container builds. Any stage defined afterwards will be ignored.
Example value: build-env
from_registry
import ros_cdk_core
ros_cdk_core.DockerImage.from_registry(
image: str
)
Reference an image on DockerHub or another online registry.
- Type: str
the image name.
Properties
Name | Type | Description |
---|---|---|
image |
str |
No description. |
image
Required
image: str
- Type: str