Links

Commands

Below is a list of Garden CLI commands and usage information.
The commands should be run in a Garden project, and are always scoped to that project.
Note: You can get a list of commands in the CLI by running garden -h/--help, and detailed help for each command using garden <command> -h/--help
The Outputs sections show the output structure when running the command with --output yaml. The same structure is used when --output json is used and when querying through the REST API, but in JSON format.

Global options

The following option flags can be used with any of the CLI commands:
Argument
Alias
Type
Description
--root
-r
path
Override project root directory (defaults to working directory). Can be absolute or relative to current directory.
--silent
-s
boolean
Suppress log output. Same as setting --logger-type=quiet.
--env
-e
string
The environment (and optionally namespace) to work against.
--logger-type
quiet basic fancy json
Set logger type. fancy updates log lines in-place when their status changes (e.g. when tasks complete), basic appends a new log line when a log line's status changes, json same as basic, but renders log lines as JSON, quiet suppresses all log output, same as --silent.
--log-level
-l
error warn info verbose debug silly 0 1 2 3 4 5
Set logger level. Values can be either string or numeric and are prioritized from 0 to 5 (highest to lowest) as follows: error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5.
--output
-o
json yaml
Output command result in specified format (note: disables progress logging and interactive functionality).
--emoji
boolean
Enable emoji in output (defaults to true if the environment supports it).
--show-timestamps
boolean
Show timestamps with log output. When enabled, Garden will use the basic logger. I.e., log status changes are rendered as new lines instead of being updated in-place.
--yes
-y
boolean
Automatically approve any yes/no prompts during execution.
--force-refresh
boolean
Force refresh of any caches, e.g. cached provider statuses.
--var
array:string
Set a specific variable value, using the format <key>=<value>, e.g. `--var some-key=custom-value`. This will override any value set in your project configuration. You can specify multiple variables by separating with a comma, e.g. `--var key-a=foo,key-b="value with quotes"`.
--version
-v
boolean
Show the current CLI version.
--help
-h
boolean
Show help
--disable-port-forwards
boolean
Disable automatic port forwarding when in watch/hot-reload mode. Note that you can also set GARDEN_DISABLE_PORT_FORWARDS=true in your environment.

garden build

Build your modules.
Builds all or specified modules, taking into account build dependency order. Optionally stays running and automatically builds modules if their source (or their dependencies' sources) change.
Examples:
garden build # build all modules in the project
garden build my-module # only build my-module
garden build --force # force rebuild of modules
garden build --watch # watch for changes to code

Usage

garden build [modules] [options]

Arguments

Argument
Required
Description
modules
No
Specify module(s) to build. Use comma as a separator to specify multiple modules.

Options

Argument
Alias
Type
Description
--force
-f
boolean
Force rebuild of module(s).
--watch
-w
boolean
Watch for changes in module(s) and auto-build.
--with-dependants
boolean
Also rebuild modules that have build dependencies on one of the modules specified as CLI arguments (recursively). Note: This option has no effect unless a list of module names is specified as CLI arguments (since then, every module in the project will be rebuilt).

Outputs

# A map of all modules that were built (or builds scheduled/attempted for) and information about the builds.
builds:
<module name>:
# The full log from the build.
buildLog:
# Set to true if the build was fetched from a remote registry.
fetched:
# Set to true if the build was performed, false if it was already built, or fetched from a registry
fresh:
# Additional information, specific to the provider.
details:
# Set to true if the build was not attempted, e.g. if a dependency build failed.
aborted:
# The duration of the build in msec, if applicable.
durationMsec:
# Whether the build was succeessful.
success:
# An error message, if the build failed.
error:
# The version of the module, service, task or test.
version:
# A map of all services that were deployed (or deployment scheduled/attempted for) and the service status.
deployments:
<service name>:
# When the service was first deployed by the provider.
createdAt:
# Additional detail, specific to the provider.
detail:
# Whether the service was deployed with dev mode enabled.
devMode:
# Whether the service was deployed with local mode enabled.
localMode:
namespaceStatuses:
- pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# The ID used for the service by the provider (if not the same as the service name).
externalId:
# The provider version of the deployed service (if different from the Garden module version.
externalVersion:
# A list of ports that can be forwarded to from the Garden agent by the provider.
forwardablePorts:
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
name:
# The preferred local port to use for forwarding.
preferredLocalPort:
# The protocol of the port.
protocol:
# The target name/hostname to forward to (defaults to the service name).
targetName:
# The target port on the service.
targetPort:
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
urlProtocol:
# List of currently deployed ingress endpoints for the service.
ingresses:
- # The port number that the service is exposed on internally.
# This defaults to the first specified port for the service.
port:
# The ingress path that should be matched to route to this service.
path:
# The protocol to use for the ingress.
protocol:
# The hostname where the service can be accessed.
hostname:
# Latest status message of the service (if any).
lastMessage:
# Latest error status message of the service (if any).
lastError:
# A map of values output from the service.
outputs:
<name>:
# How many replicas of the service are currently running.
runningReplicas:
# The current deployment status of the service.
state:
# When the service was last updated by the provider.
updatedAt:
# Set to true if the build was not attempted, e.g. if a dependency build failed.
aborted:
# The duration of the build in msec, if applicable.
durationMsec:
# Whether the build was succeessful.
success:
# An error message, if the build failed.
error:
# The version of the module, service, task or test.
version:
# A map of all tests that were run (or scheduled/attempted) and the test results.
tests:
<test name>:
# The name of the module that was run.
moduleName:
# The command that was run in the module.
command:
# The exit code of the run (if applicable).
exitCode:
# When the module run was started.
startedAt:
# When the module run was completed.
completedAt:
# The output log from the run.
log:
namespaceStatus:
pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# A map of primitive values, output from the test.
outputs:
# Number, string or boolean
<name>:
# The name of the test that was run.
testName:
# Set to true if the build was not attempted, e.g. if a dependency build failed.
aborted:
# The duration of the build in msec, if applicable.
durationMsec:
# Whether the build was succeessful.
success:
# An error message, if the build failed.
error:
# The version of the module, service, task or test.
version:
# A map of all raw graph results. Avoid using this programmatically if you can, and use more structured keys instead.
graphResults:

garden call

Call a service ingress endpoint.
Resolves the deployed ingress endpoint for the given service and path, calls the given endpoint and outputs the result.
Examples:
garden call my-container
garden call my-container/some-path
Note: Currently only supports simple GET requests for HTTP/HTTPS ingresses.

Usage

garden call <serviceAndPath>

Arguments

Argument
Required
Description
serviceAndPath
Yes
The name of the service to call followed by the ingress path (e.g. my-container/somepath).

garden config analytics-enabled

Update your preferences regarding analytics.
To help us make Garden better, you can opt in to the collection of usage data. We make sure all the data collected is anonymized and stripped of sensitive information. We collect data about which commands are run, what tasks they trigger, which API calls are made to your local Garden server, as well as some info about the environment in which Garden runs.
You will be asked if you want to opt-in when running Garden for the first time and you can use this command to update your preferences later.
Examples:
garden config analytics-enabled true # enable analytics
garden config analytics-enabled false # disable analytics

Usage

garden config analytics-enabled [enable]

Arguments

Argument
Required
Description
enable
No
Enable analytics. Defaults to "true"

garden create project

Create a new Garden project.
Creates a new Garden project configuration. The generated config includes some default values, as well as the schema of the config in the form of commentented-out fields. Also creates a default (blank) .gardenignore file in the same path.
Examples:
garden create project # create a Garden project config in the current directory
garden create project --dir some-dir # create a Garden project config in the ./some-dir directory
garden create project --name my-project # set the project name to my-project
garden create project --interactive=false # don't prompt for user inputs when creating the config

Usage

garden create project [options]

Options

Argument
Alias
Type
Description
--skip-comments
boolean
Set to true to disable comment generation.
--dir
path
Directory to place the project in (defaults to current directory).
--filename
string
Filename to place the project config in (defaults to project.garden.yml).
--interactive
-i
boolean
Set to false to disable interactive prompts.
--name
string
Name of the project (defaults to current directory name).

garden create module

Create a new Garden module.
Creates a new Garden module configuration. The generated config includes some default values, as well as the schema of the config in the form of commentented-out fields.
Examples:
garden create module # create a Garden module config in the current directory
garden create module --dir some-dir # create a Garden module config in the ./some-dir directory
garden create module --name my-module # set the module name to my-module
garden create module --interactive=false # don't prompt for user inputs when creating the module

Usage

garden create module [options]

Options

Argument
Alias
Type
Description
--skip-comments
boolean
Set to true to disable comment generation.
--dir
path
Directory to place the module in (defaults to current directory).
--filename
string
Filename to place the module config in (defaults to garden.yml).
--interactive
-i
boolean
Set to false to disable interactive prompts.
--name
string
Name of the module (defaults to current directory name).
--type
string
The module type to create. Required if --interactive=false.

garden delete secret

Delete a secret from the environment.
Returns with an error if the provided key could not be found by the provider.
Examples:
garden delete secret kubernetes somekey
garden del secret local-kubernetes some-other-key

Usage

garden delete secret <provider> <key>

Arguments

Argument
Required
Description
provider
Yes
The name of the provider to remove the secret from.
key
Yes
The key of the configuration variable. Separate with dots to get a nested key (e.g. key.nested).

garden delete environment

Deletes a running environment.
This will delete all services in the specified environment, and trigger providers to clear up any other resources and reset it. When you then run garden deploy, the environment will be reconfigured.
This can be useful if you find the environment to be in an inconsistent state, or need/want to free up resources.

Usage

garden delete environment [options]

Options

Argument
Alias
Type
Description
--dependants-first
boolean
Delete services in reverse dependency order. That is, if service-a has a dependency on service-b, service-a will be deleted before service-b when calling garden delete environment service-a,service-b --dependants-first. When this flag is not used, all services in the project are deleted simultaneously.

Outputs

# The status of each provider in the environment.
providerStatuses:
# Description of an environment's status for a provider.
<name>:
# Set to true if the environment is fully configured for a provider.
ready:
# Use this to include additional information that is specific to the provider.
detail:
namespaceStatuses:
- pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# Output variables that modules and other variables can reference.
outputs:
<name>:
# Set to true to disable caching of the status.
disableCache:
# The status of each service in the environment.
serviceStatuses:
<name>:
# When the service was first deployed by the provider.
createdAt:
# Additional detail, specific to the provider.
detail:
# Whether the service was deployed with dev mode enabled.
devMode:
# Whether the service was deployed with local mode enabled.
localMode:
namespaceStatuses:
- pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# The ID used for the service by the provider (if not the same as the service name).
externalId:
# The provider version of the deployed service (if different from the Garden module version.
externalVersion:
# A list of ports that can be forwarded to from the Garden agent by the provider.
forwardablePorts:
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
name:
# The preferred local port to use for forwarding.
preferredLocalPort:
# The protocol of the port.
protocol:
# The target name/hostname to forward to (defaults to the service name).
targetName:
# The target port on the service.
targetPort:
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
urlProtocol:
# List of currently deployed ingress endpoints for the service.
ingresses:
- # The port number that the service is exposed on internally.
# This defaults to the first specified port for the service.
port:
# The ingress path that should be matched to route to this service.
path:
# The protocol to use for the ingress.
protocol:
# The hostname where the service can be accessed.
hostname:
# Latest status message of the service (if any).
lastMessage:
# Latest error status message of the service (if any).
lastError:
# A map of values output from the service.
outputs:
<name>:
# How many replicas of the service are currently running.
runningReplicas:
# The current deployment status of the service.
state:
# When the service was last updated by the provider.
updatedAt:
# The Garden module version of the deployed service.
version:

garden delete service

Deletes running services.
Deletes (i.e. un-deploys) the specified services. Deletes all services in the project if no arguments are provided. Note that this command does not take into account any services depending on the deleted service/services, and might therefore leave the project in an unstable state. Running garden deploy will re-deploy any missing services.
Examples:
garden delete service my-service # deletes my-service
garden delete service # deletes all deployed services in the project

Usage

garden delete service [services] [options]

Arguments

Argument
Required
Description
services
No
The name(s) of the service(s) to delete. Use comma as a separator to specify multiple services.

Options

Argument
Alias
Type
Description
--dependants-first
boolean
Delete services in reverse dependency order. That is, if service-a has a dependency on service-b, service-a will be deleted before service-b when calling garden delete environment service-a,service-b --dependants-first. When this flag is not used, all services in the project are deleted simultaneously.
--with-dependants
boolean
Also delete services that have service dependencies on one of the services specified as CLI arguments (recursively). When used, this option implies --dependants-first. Note: This option has no effect unless a list of service names is specified as CLI arguments (since then, every service in the project will be deleted).

Outputs

<name>:
# When the service was first deployed by the provider.
createdAt:
# Additional detail, specific to the provider.
detail:
# Whether the service was deployed with dev mode enabled.
devMode:
# Whether the service was deployed with local mode enabled.
localMode:
namespaceStatuses:
- pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# The ID used for the service by the provider (if not the same as the service name).
externalId:
# The provider version of the deployed service (if different from the Garden module version.
externalVersion:
# A list of ports that can be forwarded to from the Garden agent by the provider.
forwardablePorts:
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
name:
# The preferred local port to use for forwarding.
preferredLocalPort:
# The protocol of the port.
protocol:
# The target name/hostname to forward to (defaults to the service name).
targetName:
# The target port on the service.
targetPort:
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
urlProtocol:
# List of currently deployed ingress endpoints for the service.
ingresses:
- # The port number that the service is exposed on internally.
# This defaults to the first specified port for the service.
port:
# The ingress path that should be matched to route to this service.
path:
# The protocol to use for the ingress.
protocol:
# The hostname where the service can be accessed.
hostname:
# Latest status message of the service (if any).
lastMessage:
# Latest error status message of the service (if any).
lastError:
# A map of values output from the service.
outputs:
<name>:
# How many replicas of the service are currently running.
runningReplicas:
# The current deployment status of the service.
state:
# When the service was last updated by the provider.
updatedAt:
# The Garden module version of the deployed service.
version:

garden deploy

Deploy service(s) to your environment.
Deploys all or specified services, taking into account service dependency order. Also builds modules and dependencies if needed.
Optionally stays running and automatically re-builds and re-deploys services if their module source (or their dependencies' sources) change.
Examples:
garden deploy # deploy all modules in the project
garden deploy my-service # only deploy my-service
garden deploy service-a,service-b # only deploy service-a and service-b
garden deploy --force # force re-deploy of modules, even if they're already deployed
garden deploy --watch # watch for changes to code
garden deploy --dev=my-service # deploys all services, with dev mode enabled for my-service
garden deploy --dev # deploys all compatible services with dev mode enabled
garden deploy --local=my-service # deploys all services, with local mode enabled for my-service
garden deploy --local # deploys all compatible services with local mode enabled
garden deploy --env stage # deploy your services to an environment called stage
garden deploy --skip service-b # deploy all services except service-b
garden deploy --forward # deploy all services and start port forwards without watching for changes

Usage

garden deploy [services] [options]

Arguments

Argument
Required
Description
services
No
The name(s) of the service(s) to deploy (skip to deploy all services). Use comma as a separator to specify multiple services.

Options

Argument
Alias
Type
Description
--force
boolean
Force redeploy of service(s).
--force-build
boolean
Force rebuild of module(s).
--watch
-w
boolean
Watch for changes in module(s) and auto-deploy.
--dev-mode
--dev
array:string
The name(s) of the service(s) to deploy with dev mode enabled. Use comma as a separator to specify multiple services. Use * to deploy all services with dev mode enabled. When this option is used, the command is run in watch mode (i.e. implicitly sets the --watch/-w flag).
--hot-reload
--hot
array:string
The name(s) of the service(s) to deploy with hot reloading enabled. Use comma as a separator to specify multiple services. Use * to deploy all services with hot reloading enabled (ignores services belonging to modules that don't support or haven't configured hot reloading). When this option is used, the command is run in watch mode (i.e. implicitly sets the --watch/-w flag).
--local-mode
--local
array:string
[EXPERIMENTAL] The name(s) of the service(s) to be started locally with local mode enabled. Use comma as a separator to specify multiple services. Use * to deploy all services with local mode enabled. When this option is used, the command is run in persistent mode.
This always takes the precedence over the dev mode if there are any conflicts, i.e. if the same services are passed to both `--dev` and `--local` options.
--skip
array:string
The name(s) of services you'd like to skip when deploying.
--skip-dependencies
--nodeps
boolean
Deploy the specified services, but don't deploy any additional services that they depend on or run any tasks that they depend on. This option can only be used when a list of service names is passed as CLI arguments. This can be useful e.g. when your stack has already been deployed, and you want to deploy a subset of services in dev mode without redeploying any service dependencies that may have changed since you last deployed.
--forward
boolean
Create port forwards and leave process running without watching for changes. Ignored if --watch/-w flag is set or when in dev or hot-reload mode.
--skip-watch
boolean
[EXPERIMENTAL] If set to `false` while in dev-mode (i.e. the --dev-mode/--dev flag is used) then file syncing will still work but Garden will ignore changes to config files and services that are not in dev mode.
This can be a performance improvement for projects that have a large number of files and where only syncing is needed when in dev mode.
Note that this flag cannot used if hot reloading is enabled.
This behaviour will change in a future release in favour of a "smarter" watching mechanism.

Outputs

# A map of all modules that were built (or builds scheduled/attempted for) and information about the builds.
builds:
<module name>:
# The full log from the build.
buildLog:
# Set to true if the build was fetched from a remote registry.
fetched:
# Set to true if the build was performed, false if it was already built, or fetched from a registry
fresh:
# Additional information, specific to the provider.
details:
# Set to true if the build was not attempted, e.g. if a dependency build failed.
aborted:
# The duration of the build in msec, if applicable.
durationMsec:
# Whether the build was succeessful.
success:
# An error message, if the build failed.
error:
# The version of the module, service, task or test.
version:
# A map of all services that were deployed (or deployment scheduled/attempted for) and the service status.
deployments:
<service name>:
# When the service was first deployed by the provider.
createdAt:
# Additional detail, specific to the provider.
detail:
# Whether the service was deployed with dev mode enabled.
devMode:
# Whether the service was deployed with local mode enabled.
localMode:
namespaceStatuses:
- pluginName:
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
# letter, and cannot end with a dash) and must not be longer than 63 characters.
namespaceName:
state:
# The ID used for the service by the provider (if not the same as the service name).
externalId:
# The provider version of the deployed service (if different from the Garden module version.
externalVersion:
# A list of ports that can be forwarded to from the Garden agent by the provider.
forwardablePorts:
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
name:
# The preferred local port to use for forwarding.
preferredLocalPort:
# The protocol of the port.
protocol:
# The target name/hostname to forward to (defaults to the service name).
targetName:
# The target port on the service.
targetPort:
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
urlProtocol:
# List of currently deployed ingress endpoints for the service.
ingresses:
- # The port number that the service is exposed on internally.
# This defaults to the first specified port for the service.
port:
# The ingress path that should be matched to route to this service.
path:
# The protocol to use for the ingress.
protocol:
# The hostname where the service can be accessed.
hostname:
# Latest status message of the service (if any).
lastMessage:
# Latest error status message of the service (if any).
lastError:
# A map of values output from the service.
outputs:
<name>:
# How many replicas of the service are currently running.