Skip to content

dstack apply

This command applies a given configuration. If a resource does not exist, dstack apply creates the resource. If a resource exists, dstack apply updates the resource in-place or re-creates the resource if the update is not possible.

To mount a Git repo to the run's container, dstack apply requires that you run dstack init first, or specify a repo to work with via -P (or --repo), or specify --no-repo if you don't need any repo for the run.

Usage

$ dstack apply --help
Usage: dstack apply [--project NAME] [-h [TYPE]] [-f FILE] [-y] [--force] [-d]

Options:
  --project NAME        The name of the project. Defaults to $DSTACK_PROJECT
  -h, --help [TYPE]     Show this help message and exit.
  -f, --file FILE       The path to the configuration file. Specify - to read
                        configuration from stdin. Defaults to $PWD/.dstack.yml
  -y, --yes             Do not ask for confirmation
  --force               Force apply when no changes detected
  -d, --detach          Exit immediately after submitting configuration

Type `dstack apply -h CONFIGURATION_TYPE` to see configuration-specific options.

User SSH key

By default, dstack uses its own SSH key to attach to runs (~/.dstack/ssh/id_rsa). It is possible to override this key via the --ssh-identity argument.