gcloud alpha code dev

NAME
gcloud alpha code dev - run a Cloud Run service in a local development environment
SYNOPSIS
gcloud alpha code dev[SERVICE_CONFIG][--[no-]allow-secret-manager][--cloudsql-instances=[CLOUDSQL_INSTANCE,…]][--cpu=CPU][--image=IMAGE][--local-port=LOCAL_PORT][--memory=MEMORY][--minikube-vm-driver=MINIKUBE_VM_DRIVER; default="docker"][--namespace=NAMESPACE][--secrets=[KEY=VALUE,…]][--service-name=SERVICE_NAME][--source=SOURCE][--no-stop-cluster][--application-default-credential    |--service-account=SERVICE_ACCOUNT][--builder=BUILDER    |--dockerfile=DOCKERFILE; default="Dockerfile"][--env-vars=[KEY=VALUE,…]    |--env-vars-file=FILE_PATH][--kube-context=KUBE_CONTEXT    |--minikube-profile=MINIKUBE_PROFILE][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Run a Cloud Run service in a local development environment.

This command takes Cloud Run source, builds it, and runs it on the localmachine. This command also watches the relevant source files and updates thecontainer when they change.

EXAMPLES
If building images using a Dockerfile:
gcloudalphacodedev--dockerfile=<path_to_dockerfile>

If the Dockerfile is namedDockerfile and is located in the currentdirectory, the--dockerfile flag may be omitted:

gcloudalphacodedev

To access Google Cloud Platform services with the current user's credentials,login to obtain the application default credentials and invoke this command withthe--application-default-credential flag.

gcloudauthapplication-defaultlogingcloudalphacodedev--dockerfile=<path_to_dockerfile>--application-default-credential
POSITIONAL ARGUMENTS
[SERVICE_CONFIG]
service.yaml filename override. Defaults to the first file matching*service.dev.yaml then*service.yaml, if any exist.This path is relative to the --source dir. An App Engine config path (typicallyapp.yaml) may also be provided here, and we will build with a CloudNative Computing Foundation Buildpack builder selected fromgcr.io/gae-runtimes/buildpacks, according to the App Engineruntimespecified in app.yaml.
FLAGS
--[no-]allow-secret-manager
Suppress warnings if secrets need to be pulled from secret manager. Use--allow-secret-manager to enable and--no-allow-secret-manager to disable.
--cloudsql-instances=[CLOUDSQL_INSTANCE,…]
Cloud SQL instance connection strings. Must be in the form<project>:<region>:<instance>.
--cpu=CPU
Container CPU limit. Limit is expressed as a number of CPUs. Fractional CPUlimits are allowed (e.g. 1.5).
--image=IMAGE
Name for the built image.
--local-port=LOCAL_PORT
Local port to which the service connection is forwarded. If this flag is notset, then a random port is chosen.
--memory=MEMORY
Container memory limit. Limit is expressed either as an integer representing thenumber of bytes or an integer followed by a unit suffix. Valid unit suffixes are"B", "KB", "MB", "GB", "TB", "KiB", "MiB", "GiB", "TiB", or "PiB".
--minikube-vm-driver=MINIKUBE_VM_DRIVER; default="docker"
If running on minikube, use this vm driver.
--namespace=NAMESPACE
Kubernetes namespace for development kubernetes objects.
--secrets=[KEY=VALUE,…]
List of key-value pairs to set as secrets.
--service-name=SERVICE_NAME
Name of the service.
--source=SOURCE
The directory containing the source to build. If not specified, the currentdirectory is used.
--stop-cluster
If running on minikube, stop the minkube profile at the end of the session.Enabled by default, use--no-stop-cluster to disable.
At most one of these can be specified:
--application-default-credential
When connecting to Google Cloud Platform services, use the application defaultcredential.
--service-account=SERVICE_ACCOUNT
When connecting to Google Cloud Platform services, use a service account key.
At most one of these can be specified:
--builder=BUILDER
Build with a given Cloud Native Computing Foundation Buildpack builder.
--dockerfile=DOCKERFILE; default="Dockerfile"
Dockerfile for the service image.
At most one of these can be specified:
--env-vars=[KEY=VALUE,…]
List of key-value pairs to set as environment variables.
--env-vars-file=FILE_PATH
Path to a local YAML file with definitions for all environment variables.
At most one of these can be specified:
--kube-context=KUBE_CONTEXT
Kubernetes context.
--minikube-profile=MINIKUBE_PROFILE
Minikube profile.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. This variant is also available:
gcloudbetacodedev

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.