Skip to main content

prefect.docker.docker_image

Classes

DockerImage

Configuration used to build and push a Docker image for a deployment. Attributes:
  • name: The name of the Docker image to build, including the registry and repository.
  • tag: The tag to apply to the built image.
  • dockerfile: The path to the Dockerfile to use for building the image. If not provided, a default Dockerfile will be generated.
  • stream_progress_to: A stream to write build and push progress output to. Defaults to sys.stdout. Set to None to suppress output.
  • build_backend: The backend to use for building images. "docker-py" (default) uses the docker-py library. "buildx" uses python-on-whales for BuildKit/buildx support, enabling features like build secrets, SSH forwarding, and multi-platform builds.
  • **build_kwargs: Additional keyword arguments to pass to the Docker build request. When build_backend="docker-py", these are forwarded to docker-py’s client.api.build(). When build_backend="buildx", these are forwarded to python_on_whales.docker.buildx.build() and may include secrets, ssh, cache_from, cache_to, platforms, and push.
Methods:

build

build(self) -> None

push

push(self) -> None

reference

reference(self) -> str