Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Linux
Windows
Você cria uma instância de máquina virtual (VM) a partir de uma imagem
do SO ou de uma imagem de disco. Neste documento,
você verá como determinar a imagem do SO de origem ou a imagem do disco de origem de uma VM.
Antes de começar
Configure a autenticação, caso ainda não tenha feito isso.
A autenticação verifica sua identidade para acesso a serviços e APIs do Google Cloud . Para executar
códigos ou amostras de um ambiente de desenvolvimento local, autentique-se no
Compute Engine selecionando uma das seguintes opções:
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
Instale a CLI do Google Cloud.
Após a instalação,
inicialize a CLI do Google Cloud executando o seguinte comando:
DISK_NAME: o nome do disco em que a origem da
visualização será exibida.
ZONE: a zona em que o disco está localizado.
SOURCE: um valor que especifica se
a imagem do SO de origem ou da imagem do disco de origem será retornada. Defina como sourceDisk
ou como sourceImage. Nenhum valor é retornado ao especificar sourceDisk
ou sourceImage, a menos que haja uma imagem de SO de origem ou uma
imagem de disco de origem. Se nenhum valor for retornado, especifique o outro valor e
execute o comando novamente.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME
Substitua:
PROJECT_ID: o ID do projeto;
ZONE: a zona que contém a VM;
VM_NAME: O nome da VM.
Visualize a imagem do SO de origem ou a imagem do disco de origem usando o
método disks.get.
Para uma VM com imagem de SO de origem, esse método retorna a imagem de origem
que foi usada para criar o disco no campo sourceImage. Para uma VM
que tem uma imagem de disco de origem, esse método retorna a imagem
de origem no campo sourceDisk.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[[["\u003cp\u003eThis guide explains how to identify the source OS image or source disk image used to create a virtual machine (VM) instance.\u003c/p\u003e\n"],["\u003cp\u003eYou can determine the source image using the Google Cloud console, the Google Cloud CLI (gcloud), or the Compute Engine API.\u003c/p\u003e\n"],["\u003cp\u003eTo access and use the services, authentication is needed and the methods to authenticate are explained for the Google Cloud Console, the gcloud CLI, and REST.\u003c/p\u003e\n"],["\u003cp\u003eRequired permissions include \u003ccode\u003ecompute.instances.get\u003c/code\u003e on the specific VM instance.\u003c/p\u003e\n"],["\u003cp\u003eThe location of the required source image information can be found in the storage section under the boot disk in the Google Cloud Console and by using the gcloud command lines to view the disk and then its source.\u003c/p\u003e\n"]]],[],null,["# View the source image of a VM\n\nLinux Windows\n\n*** ** * ** ***\n\nYou create a virtual machine (VM) instance from either an [OS\nimage](/compute/docs/images/os-details) or a disk image. This document\nshows you how to determine the source OS image or source disk image of a VM.\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity 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:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nView the source OS image or source disk image of a VM\n-----------------------------------------------------\n\nTo view the source OS image or source disk image of a VM, use the\nGoogle Cloud console, Google Cloud CLI, or Compute Engine API.\n\n#### Permissions required for this task\n\nTo perform this task, you must have the following\n[permissions](/iam/docs/overview#permissions):\n\n\n- `compute.instances.get` on the instance \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. Click the **Name** of the VM.\n\n3. The name of the source OS image or source disk image is in\n **Storage** \\\u003e **Boot\n disk** \\\u003e **Image**.\n\n### gcloud\n\n1. View the disks attached to a VM by using the following [`gcloud compute\n instances describe`\n command](/sdk/gcloud/reference/compute/instances/describe):\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the VM.\n2. View the source OS image or source disk image of the disk by using the\n following [`gcloud compute disks describe`\n command](/sdk/gcloud/reference/compute/disks/describe):\n\n ```\n gcloud compute disks describe DISK_NAME \\\n --zone=ZONE \\\n --format=\"get(SOURCE)\"\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e: the name of the disk to view the\n source of.\n\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone that the disk is located in.\n\n - \u003cvar translate=\"no\"\u003eSOURCE\u003c/var\u003e: a value that specifies whether to\n return the source OS image or the source disk image. Set to `sourceDisk`\n or to `sourceImage`. No value is returned when specifying `sourceDisk`\n or `sourceImage` unless there is a corresponding source OS image or a\n source disk image. If no value is returned, specify the other value and\n run the command again.\n\n### REST\n\n1. View the disks attached to a VM by using the following [`instances.get`\n method](/compute/docs/reference/rest/v1/instances/get):\n\n ```\n GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone containing the VM\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM\n2. View the source OS image or source disk image of the disk by using the\n [`disks.get` method](/compute/docs/reference/rest/v1/disks/get).\n\n For a VM that has a source OS image, this method returns the source image\n that was used to create the disk in the `sourceImage` field. For a VM\n that has a source disk image, this method instead returns the source\n image in the `sourceDisk` field. \n\n ```\n GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone containing the disk\n - \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e: the name of the disk\n\nWhat's next\n-----------\n\n- Learn more about [OS images](/compute/docs/images) on Compute Engine."]]