This page describes creating a service and viewing information about a service. Services are the main resources of Cloud Run. Each service has a unique and permanent URL that will not change over time as you deploy new revisions to it.
The service's permanent domain consists of the service name and a hash.
Creating a service
You create a new service by deploying a container image to it for the first time. Deploying a new service has more instructions.
Viewing the list of services in your project
You can view a list of the available services in your project using Cloud Console or the gcloud command line:
To view the services list:
Examine the displayed list of services for your project:
To list the services in your project:
gcloud run services list
Note that each service has an associated URL.
You can filter this list by properties of the service definition, such as an assigned label.
Copying a service
You can make a copy of an existing service using Cloud Console or YAML. You can change anything you want in the copy, including name and region.
To copy a service:
Select the service to copy from the displayed list of services for your project:
In the service copy page, set or change any values you want to change, such as region, etc. If you are keeping the same region, you must provide a new name for the service.
Click Create to make a copy and deploy it using the new service name.
You can download and view existing service configuration using the
gcloud run services describe --format export command, which yields
cleaned results in YAML format. You can then modify the fields described below and
upload the modified YAML using the
gcloud beta run services replace command.
Make sure you only modify fields as documented.
To view and download the configuration:
gcloud run services describe SERVICE --format export > service.yaml
Make any desired configuration changes to the service as described in the various configuration pages.
apiVersion: serving.knative.dev/v1 kind: Service metadata: annotations: ... name: SERVICE ... spec: template: metadata: annotations: ... name: REVISION-NAME
- If you are not deploying the copy to a different region, replace SERVICE with the name you want to use for the copy. If you are deploying the copy to a different region, you can use the old name.
- Make sure the value for REVISION-NAME starts with the service
name (SERVICE). For example, if the new service name is
mynewfoo, then the revision name must be in the format
mynewfoo-whatever. Optionally delete the value altogether and a new revision name is created automatically.
Copy the service using the following command:
gcloud beta run services replace service.yaml
--regionflag to deploy the copy to a different region.
Viewing more details about a service
To see more details about a service,
To view a service's details:
Click on the desired service in the displayed list of services for your project to open the service details view:
Note the REVISIONS, LOGS and DETAILS tabs. The revisions tab shows the list of revisions, the logs tab shows the service logs, and the details tab shows the current authentication or connectivity settings.
To view details about a service:
gcloud run services describe SERVICEReplace SERVICE with the name of the service.
You can use the
--format flag to format
the output. For example as YAML:
gcloud run services describe SERVICE --format yaml
You can use
--format export to export as YAML without automatically
generated labels or status:
gcloud run services describe SERVICE --format export
You can also use the
--format flag to get
the URL of the service:
gcloud run services describe SERVICE --format='value(status.url)'
For more details on service revisions, see Managing Revisions.
Disabling an existing service
Cloud Run does not offer a direct way to make a service
stop serving traffic, but you can achieve a similar result by revoking the permission to invoke the service
to identities that are invoking the service. Notably, if your service is "public",
allUsers from the Cloud Run Invoker role (
Deleting existing services
Deleting a service deletes all resources related to this service, including all revisions of this service whether they are serving traffic or not.
When deleting a service, the container images used by the deleted revisions are not deleted automatically from Container Registry. To delete container images from Container Registry see Deleting images.
Although the service remains visible in the Google Cloud Console and in the command line interface until the deletion is fully complete, the service cannot be updated.
Note that deleting a service is permanent: there is no undo or restore. However, if after deleting a service, you deploy a new service with the same name in the same region, it will have the same endpoint URL.
To delete a service:
Locate the service you want to delete in the services list, and click its checkbox to select it.
Click DELETE. This deletes all revisions of the service.
To delete a service, use the command:
gcloud run services delete [SERVICE]
[SERVICE] with the name of your service.