Docker¶
- class torchx.workspace.docker_workspace.DockerWorkspaceMixin(*args: object, docker_client: DockerClient | None = None, **kwargs: object)[source]¶
Bases:
WorkspaceMixin[dict[str,tuple[str,str]]]Builds patched Docker images from the workspace.
Requires a local Docker daemon. For remote jobs, authenticate via
docker loginand set theimage_reporunopt.If
Dockerfile.torchxexists in the workspace it is used as the Dockerfile; otherwise a defaultCOPY . .Dockerfile is generated. Extra--build-argvalues available inDockerfile.torchx:IMAGE– the role’s base imageWORKSPACE– the workspace path
Use
.dockerignoreto exclude files from the build context.- build_workspace_and_update_role(role: Role, workspace: str, cfg: Mapping[str, str | int | float | bool | list[str] | dict[str, str] | None]) None[source]¶
Builds a Docker image from workspace on top of
role.imageand updatesrole.imagewith the resulting image id.
- dryrun_push_images(app: AppDef, cfg: Mapping[str, str | int | float | bool | list[str] | dict[str, str] | None]) dict[str, tuple[str, str]][source]¶
Replaces local
sha256:...images in app with remote paths and returns a{local_image: (repo, tag)}mapping forpush_images().