Skip to content

.dstack.yml (task)

A task can be a batch job or a web app.

The configuration file name must end with .dstack.yml (e.g., .dstack.yml or train.dstack.yml are both acceptable).


type: task

python: "3.11" # (Optional) If not specified, your local version is used

  - pip install -r requirements.txt
  - python

YAML reference


Property Description Type Default value
type Literal['task'] required
image The name of the Docker image to run Optional[str] None
entrypoint The Docker entrypoint Optional[str] None
home_dir The absolute path to the home directory inside the container str /root
registry_auth Credentials for pulling a private container Optional[RegistryAuth] None
python The major version of Python
Mutually exclusive with the image
Optional[PythonVersion] None
env The mapping or the list of environment variables Union[List[ConstrainedStrValue],Dict[str, str]] {}
setup The bash commands to run on the boot List[str] []
ports Port numbers/mapping to expose List[Union[ConstrainedIntValue,ConstrainedStrValue,PortMapping]] []
commands The bash commands to run List[str] required