class flytekit.image_spec.ImageSpec(name='flytekit', python_version=None, builder=None, source_root=None, env=None, registry=None, packages=None, conda_packages=None, conda_channels=None, requirements=None, apt_packages=None, cuda=None, cudnn=None, base_image=None, platform='linux/amd64', pip_index=None, pip_extra_index_url=None, registry_config=None, commands=None, tag_format=None)[source]

This class is used to specify the docker image that will be used to run the task.

  • name (str) – name of the image.

  • python_version (str) – python version of the image. Use default python in the base image if None.

  • builder (str | None) – Type of plugin to build the image. Use envd by default.

  • source_root (str | None) – source root of the image.

  • env (Dict[str, str] | None) – environment variables of the image.

  • registry (str | None) – registry of the image.

  • packages (List[str] | None) – list of python packages to install.

  • conda_packages (List[str] | None) – list of conda packages to install.

  • conda_channels (List[str] | None) – list of conda channels.

  • requirements (str | None) – path to the requirements.txt file.

  • apt_packages (List[str] | None) – list of apt packages to install.

  • cuda (str | None) – version of cuda to install.

  • cudnn (str | None) – version of cudnn to install.

  • base_image (str | ImageSpec | None) – base image of the image.

  • platform (str) – Specify the target platforms for the build output (for example, windows/amd64 or linux/amd64,darwin/arm64

  • pip_index (str | None) – Specify the custom pip index url

  • pip_extra_index_url (List[str] | None) – Specify one or more pip index urls as a list

  • registry_config (str | None) – Specify the path to a JSON registry config file

  • commands (List[str] | None) – Command to run during the building process

  • tag_format (str | None) – Custom string format for image tag. The ImageSpec hash passed in as spec_hash. For example, to add a “dev” suffix to the image tag, set tag_format=”{spec_hash}-dev”



Check if the image exists in the registry.

Return type:



Builder that returns a new image spec with force push enabled.

Return type:



Full image name with tag.

Return type:


Return type:



Builder that returns a new image spec with additional list of apt packages that will be executed during the building process.


apt_packages (str | List[str])

Return type:



Builder that returns a new image spec with an additional list of commands that will be executed during the building process.


commands (str | List[str])

Return type:



Builder that returns a new image speck with additional python packages that will be installed during the building process.


packages (str | List[str])

Return type:



apt_packages: List[str] | None = None
base_image: str | ImageSpec | None = None
builder: str | None = None
commands: List[str] | None = None
conda_channels: List[str] | None = None
conda_packages: List[str] | None = None
cuda: str | None = None
cudnn: str | None = None
env: Dict[str, str] | None = None
name: str = 'flytekit'
packages: List[str] | None = None
pip_extra_index_url: List[str] | None = None
pip_index: str | None = None
platform: str = 'linux/amd64'
python_version: str = None
registry: str | None = None
registry_config: str | None = None
requirements: str | None = None
source_root: str | None = None
tag_format: str | None = None