Skip to content

Need help?

Reach out to us on Discord

Discord

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, specify it via repos in the configuration or via -P (or --repo).

If a Git repo is private, dstack will automatically try to use your default Git credentials (from ~/.ssh/config or ~/.config/gh/hosts.yml). If you want to use custom credentials, you can provide them with --token or --git-identity, or with dstack init.

Usage

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

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
  -v, --verbose         Show all plan properties including those with default
                        values

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

User SSH key

By default, dstack attaches to runs using the user's SSH key automatically created and managed by dstack. The CLI downloads it from the server and stores it under ~/.dstack/ssh/. To use a different key for the run, pass the path to its private key via --ssh-identity.

SSH proxy

If the SSH proxy is configured, you can also use any key uploaded under SSH keys in the user settings.