You can only delete custom images that you, or someone who has access to the project, have added.
Before you begin
- Read the Images document.
-
If you haven't already, then set up authentication.
Authentication is
the process by which your identity is verified for access to Google Cloud services and APIs.
To run code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- Set a default region and zone.
Python
To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
For more information, see Set up authentication for a local development environment.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Delete a custom image
Use one of the following methods to delete the image.
Console
In the Google Cloud console, go to the Images page.
Check the box to the left of the image you want to delete.
Click Delete at the top of the page. Your image is deleted.
gcloud
Use the gcloud compute images delete
command
to delete an image:
gcloud compute images delete IMAGE_NAME
Replace IMAGE_NAME
with the name of the image to
delete.
Go
Java
Python
REST
Make a POST
request to the
images().delete
method.
Specify the name of the image you want to delete.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images/RESOURCE_ID
Replace the following:
PROJECT_ID
: the project to which the image belongs.RESOURCE_ID
: the name of the image that you want to delete.