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 fullscreen 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:
1
garden build # build all modules in the project
2
garden build my-module # only build my-module
3
garden build --force # force rebuild of modules
4
garden build --watch # watch for changes to code
Copied!
Supported in workflows
​
Yes
​

Usage

1
garden build [modules] [options]
Copied!

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.

Outputs

1
# A map of all modules that were built (or builds scheduled/attempted for) and information about the builds.
2
builds:
3
<module name>:
4
# The full log from the build.
5
buildLog:
6
​
7
# Set to true if the build was fetched from a remote registry.
8
fetched:
9
​
10
# Set to true if the build was performed, false if it was already built, or fetched from a registry
11
fresh:
12
​
13
# Additional information, specific to the provider.
14
details:
15
​
16
# Set to true if the build was not attempted, e.g. if a dependency build failed.
17
aborted:
18
​
19
# The duration of the build in msec, if applicable.
20
durationMsec:
21
​
22
# Whether the build was succeessful.
23
success:
24
​
25
# An error message, if the build failed.
26
error:
27
​
28
# The version of the module, service, task or test.
29
version:
30
​
31
# A map of all services that were deployed (or deployment scheduled/attempted for) and the service status.
32
deployments:
33
<service name>:
34
# When the service was first deployed by the provider.
35
createdAt:
36
​
37
# Additional detail, specific to the provider.
38
detail:
39
​
40
namespaceStatuses:
41
- pluginName:
42
​
43
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
44
# letter, and cannot end with a dash) and must not be longer than 63 characters.
45
namespaceName:
46
​
47
state:
48
​
49
# The ID used for the service by the provider (if not the same as the service name).
50
externalId:
51
​
52
# The provider version of the deployed service (if different from the Garden module version.
53
externalVersion:
54
​
55
# A list of ports that can be forwarded to from the Garden agent by the provider.
56
forwardablePorts:
57
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
58
name:
59
​
60
# The preferred local port to use for forwarding.
61
preferredLocalPort:
62
​
63
# The protocol of the port.
64
protocol:
65
​
66
# The target name/hostname to forward to (defaults to the service name).
67
targetName:
68
​
69
# The target port on the service.
70
targetPort:
71
​
72
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
73
urlProtocol:
74
​
75
# List of currently deployed ingress endpoints for the service.
76
ingresses:
77
- # The ingress path that should be matched to route to this service.
78
path:
79
​
80
# The protocol to use for the ingress.
81
protocol:
82
​
83
# The hostname where the service can be accessed.
84
hostname:
85
​
86
# The port number that the service is exposed on internally.
87
# This defaults to the first specified port for the service.
88
port:
89
​
90
# Latest status message of the service (if any).
91
lastMessage:
92
​
93
# Latest error status message of the service (if any).
94
lastError:
95
​
96
# A map of values output from the service.
97
outputs:
98
<name>:
99
​
100
# How many replicas of the service are currently running.
101
runningReplicas:
102
​
103
# The current deployment status of the service.
104
state:
105
​
106
# When the service was last updated by the provider.
107
updatedAt:
108
​
109
# Set to true if the build was not attempted, e.g. if a dependency build failed.
110
aborted:
111
​
112
# The duration of the build in msec, if applicable.
113
durationMsec:
114
​
115
# Whether the build was succeessful.
116
success:
117
​
118
# An error message, if the build failed.
119
error:
120
​
121
# The version of the module, service, task or test.
122
version:
123
​
124
# A map of all tests that were run (or scheduled/attempted) and the test results.
125
tests:
126
<test name>:
127
# The name of the module that was run.
128
moduleName:
129
​
130
# The command that was run in the module.
131
command:
132
​
133
# The exit code of the run (if applicable).
134
exitCode:
135
​
136
# When the module run was started.
137
startedAt:
138
​
139
# When the module run was completed.
140
completedAt:
141
​
142
# The output log from the run.
143
log:
144
​
145
namespaceStatus:
146
pluginName:
147
​
148
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
149
# letter, and cannot end with a dash) and must not be longer than 63 characters.
150
namespaceName:
151
​
152
state:
153
​
154
# A map of primitive values, output from the test.
155
outputs:
156
# Number, string or boolean
157
<name>:
158
​
159
# The name of the test that was run.
160
testName:
161
​
162
# Set to true if the build was not attempted, e.g. if a dependency build failed.
163
aborted:
164
​
165
# The duration of the build in msec, if applicable.
166
durationMsec:
167
​
168
# Whether the build was succeessful.
169
success:
170
​
171
# An error message, if the build failed.
172
error:
173
​
174
# The version of the module, service, task or test.
175
version:
176
​
177
# A map of all raw graph results. Avoid using this programmatically if you can, and use more structured keys instead.
178
graphResults:
Copied!

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:
1
garden call my-container
2
garden call my-container/some-path
Copied!
Note: Currently only supports simple GET requests for HTTP/HTTPS ingresses.
Supported in workflows
​
No
​

Usage

1
garden call <serviceAndPath>
Copied!

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:
1
garden config analytics-enabled true # enable analytics
2
garden config analytics-enabled false # disable analytics
Copied!
Supported in workflows
​
No
​

Usage

1
garden config analytics-enabled [enable]
Copied!

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:
1
garden create project # create a Garden project config in the current directory
2
garden create project --dir some-dir # create a Garden project config in the ./some-dir directory
3
garden create project --name my-project # set the project name to my-project
4
garden create project --interactive=false # don't prompt for user inputs when creating the config
Copied!
Supported in workflows
​
No
​

Usage

1
garden create project [options]
Copied!

Options

Argument
Alias
Type
Description
--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:
1
garden create module # create a Garden module config in the current directory
2
garden create module --dir some-dir # create a Garden module config in the ./some-dir directory
3
garden create module --name my-module # set the module name to my-module
4
garden create module --interactive=false # don't prompt for user inputs when creating the module
Copied!
Supported in workflows
​
No
​

Usage

1
garden create module [options]
Copied!

Options

Argument
Alias
Type
Description
--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:
1
garden delete secret kubernetes somekey
2
garden del secret local-kubernetes some-other-key
Copied!
Supported in workflows
​
No
​

Usage

1
garden delete secret <provider> <key>
Copied!

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.
Supported in workflows
​
Yes
​

Usage

1
garden delete environment
Copied!

Outputs

1
# The status of each provider in the environment.
2
providerStatuses:
3
# Description of an environment's status for a provider.
4
<name>:
5
# Set to true if the environment is fully configured for a provider.
6
ready:
7
​
8
# Use this to include additional information that is specific to the provider.
9
detail:
10
​
11
namespaceStatuses:
12
- pluginName:
13
​
14
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
15
# letter, and cannot end with a dash) and must not be longer than 63 characters.
16
namespaceName:
17
​
18
state:
19
​
20
# Output variables that modules and other variables can reference.
21
outputs:
22
<name>:
23
​
24
# Set to true to disable caching of the status.
25
disableCache:
26
​
27
# The status of each service in the environment.
28
serviceStatuses:
29
<name>:
30
# When the service was first deployed by the provider.
31
createdAt:
32
​
33
# Additional detail, specific to the provider.
34
detail:
35
​
36
namespaceStatuses:
37
- pluginName:
38
​
39
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
40
# letter, and cannot end with a dash) and must not be longer than 63 characters.
41
namespaceName:
42
​
43
state:
44
​
45
# The ID used for the service by the provider (if not the same as the service name).
46
externalId:
47
​
48
# The provider version of the deployed service (if different from the Garden module version.
49
externalVersion:
50
​
51
# A list of ports that can be forwarded to from the Garden agent by the provider.
52
forwardablePorts:
53
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
54
name:
55
​
56
# The preferred local port to use for forwarding.
57
preferredLocalPort:
58
​
59
# The protocol of the port.
60
protocol:
61
​
62
# The target name/hostname to forward to (defaults to the service name).
63
targetName:
64
​
65
# The target port on the service.
66
targetPort:
67
​
68
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
69
urlProtocol:
70
​
71
# List of currently deployed ingress endpoints for the service.
72
ingresses:
73
- # The ingress path that should be matched to route to this service.
74
path:
75
​
76
# The protocol to use for the ingress.
77
protocol:
78
​
79
# The hostname where the service can be accessed.
80
hostname:
81
​
82
# The port number that the service is exposed on internally.
83
# This defaults to the first specified port for the service.
84
port:
85
​
86
# Latest status message of the service (if any).
87
lastMessage:
88
​
89
# Latest error status message of the service (if any).
90
lastError:
91
​
92
# A map of values output from the service.
93
outputs:
94
<name>:
95
​
96
# How many replicas of the service are currently running.
97
runningReplicas:
98
​
99
# The current deployment status of the service.
100
state:
101
​
102
# When the service was last updated by the provider.
103
updatedAt:
104
​
105
# The Garden module version of the deployed service.
106
version:
Copied!

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:
1
garden delete service my-service # deletes my-service
2
garden delete service # deletes all deployed services in the project
Copied!
Supported in workflows
​
Yes
​

Usage

1
garden delete service [services]
Copied!

Arguments

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

Outputs

1
<name>:
2
# When the service was first deployed by the provider.
3
createdAt:
4
​
5
# Additional detail, specific to the provider.
6
detail:
7
​
8
namespaceStatuses:
9
- pluginName:
10
​
11
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
12
# letter, and cannot end with a dash) and must not be longer than 63 characters.
13
namespaceName:
14
​
15
state:
16
​
17
# The ID used for the service by the provider (if not the same as the service name).
18
externalId:
19
​
20
# The provider version of the deployed service (if different from the Garden module version.
21
externalVersion:
22
​
23
# A list of ports that can be forwarded to from the Garden agent by the provider.
24
forwardablePorts:
25
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
26
name:
27
​
28
# The preferred local port to use for forwarding.
29
preferredLocalPort:
30
​
31
# The protocol of the port.
32
protocol:
33
​
34
# The target name/hostname to forward to (defaults to the service name).
35
targetName:
36
​
37
# The target port on the service.
38
targetPort:
39
​
40
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
41
urlProtocol:
42
​
43
# List of currently deployed ingress endpoints for the service.
44
ingresses:
45
- # The ingress path that should be matched to route to this service.
46
path:
47
​
48
# The protocol to use for the ingress.
49
protocol:
50
​
51
# The hostname where the service can be accessed.
52
hostname:
53
​
54
# The port number that the service is exposed on internally.
55
# This defaults to the first specified port for the service.
56
port:
57
​
58
# Latest status message of the service (if any).
59
lastMessage:
60
​
61
# Latest error status message of the service (if any).
62
lastError:
63
​
64
# A map of values output from the service.
65
outputs:
66
<name>:
67
​
68
# How many replicas of the service are currently running.
69
runningReplicas:
70
​
71
# The current deployment status of the service.
72
state:
73
​
74
# When the service was last updated by the provider.
75
updatedAt:
76
​
77
# The Garden module version of the deployed service.
78
version:
Copied!

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:
1
garden deploy # deploy all modules in the project
2
garden deploy my-service # only deploy my-service
3
garden deploy service-a,service-b # only deploy service-a and service-b
4
garden deploy --force # force re-deploy of modules, even if they're already deployed
5
garden deploy --watch # watch for changes to code
6
garden deploy --dev=my-service # deploys all services, with dev mode enabled for my-service
7
garden deploy --dev # deploys all compatible services with dev mode enabled
8
garden deploy --env stage # deploy your services to an environment called stage
9
garden deploy --skip service-b # deploy all services except service-b
Copied!
Supported in workflows
​
Yes
​

Usage

1
garden deploy [services] [options]
Copied!

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
[EXPERIMENTAL] 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).
--skip
​
array:string
The name(s) of services you'd like to skip when deploying.
--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.

Outputs

1
# A map of all modules that were built (or builds scheduled/attempted for) and information about the builds.
2
builds:
3
<module name>:
4
# The full log from the build.
5
buildLog:
6
​
7
# Set to true if the build was fetched from a remote registry.
8
fetched:
9
​
10
# Set to true if the build was performed, false if it was already built, or fetched from a registry
11
fresh:
12
​
13
# Additional information, specific to the provider.
14
details:
15
​
16
# Set to true if the build was not attempted, e.g. if a dependency build failed.
17
aborted:
18
​
19
# The duration of the build in msec, if applicable.
20
durationMsec:
21
​
22
# Whether the build was succeessful.
23
success:
24
​
25
# An error message, if the build failed.
26
error:
27
​
28
# The version of the module, service, task or test.
29
version:
30
​
31
# A map of all services that were deployed (or deployment scheduled/attempted for) and the service status.
32
deployments:
33
<service name>:
34
# When the service was first deployed by the provider.
35
createdAt:
36
​
37
# Additional detail, specific to the provider.
38
detail:
39
​
40
namespaceStatuses:
41
- pluginName:
42
​
43
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
44
# letter, and cannot end with a dash) and must not be longer than 63 characters.
45
namespaceName:
46
​
47
state:
48
​
49
# The ID used for the service by the provider (if not the same as the service name).
50
externalId:
51
​
52
# The provider version of the deployed service (if different from the Garden module version.
53
externalVersion:
54
​
55
# A list of ports that can be forwarded to from the Garden agent by the provider.
56
forwardablePorts:
57
- # A descriptive name for the port. Should correspond to user-configured ports where applicable.
58
name:
59
​
60
# The preferred local port to use for forwarding.
61
preferredLocalPort:
62
​
63
# The protocol of the port.
64
protocol:
65
​
66
# The target name/hostname to forward to (defaults to the service name).
67
targetName:
68
​
69
# The target port on the service.
70
targetPort:
71
​
72
# The protocol to use for URLs pointing at the port. This can be any valid URI protocol.
73
urlProtocol:
74
​
75
# List of currently deployed ingress endpoints for the service.
76
ingresses:
77
- # The ingress path that should be matched to route to this service.
78
path:
79
​
80
# The protocol to use for the ingress.
81
protocol:
82
​
83
# The hostname where the service can be accessed.
84
hostname:
85
​
86
# The port number that the service is exposed on internally.
87
# This defaults to the first specified port for the service.
88
port:
89
​
90
# Latest status message of the service (if any).
91
lastMessage:
92
​
93
# Latest error status message of the service (if any).
94
lastError:
95
​
96
# A map of values output from the service.
97
outputs:
98
<name>:
99
​
100
# How many replicas of the service are currently running.
101
runningReplicas:
102
​
103
# The current deployment status of the service.
104
state:
105
​
106
# When the service was last updated by the provider.
107
updatedAt:
108
​
109
# Set to true if the build was not attempted, e.g. if a dependency build failed.
110
aborted:
111
​
112
# The duration of the build in msec, if applicable.
113
durationMsec:
114
​
115
# Whether the build was succeessful.
116
success:
117
​
118
# An error message, if the build failed.
119
error:
120
​
121
# The version of the module, service, task or test.
122
version:
123
​
124
# A map of all tests that were run (or scheduled/attempted) and the test results.
125
tests:
126
<test name>:
127
# The name of the module that was run.
128
moduleName:
129
​
130
# The command that was run in the module.
131
command:
132
​
133
# The exit code of the run (if applicable).
134
exitCode:
135
​
136
# When the module run was started.
137
startedAt:
138
​
139
# When the module run was completed.
140
completedAt:
141
​
142
# The output log from the run.
143
log:
144
​
145
namespaceStatus:
146
pluginName:
147
​
148
# Valid RFC1035/RFC1123 (DNS) label (may contain lowercase letters, numbers and dashes, must start with a
149
# letter, and cannot end with a dash) and must not be longer than 63 characters.
150
namespaceName:
151
​
152
state:
153
​
154
# A map of primitive values, output from the test.
155
outputs:
156
# Number, string or boolean
157
<name>:
158
​
159
# The name of the test that was run.
160
testName:
161