Container-Images in Cloud Code für Cloud Shell speichern
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Wenn Sie eine Anwendung in einem Remote-Kubernetes-Cluster ausführen oder debuggen möchten, müssen Sie das Container-Image-Repository für Ihr Projekt definieren. Sie können jeden beliebigen Anbieter von Image-Repositories verwenden, einschließlich Artifact Registry.
Speicherort der Container-Images angeben
Wenn Sie in Ihrer IDE in Google Cloud angemeldet sind und ein Standardprojekt definiert haben, verwendet Cloud Code automatisch Ihr Standard-Container-Image-Repository gcr.io/PROJECT_ID, wobei PROJECT_ID auf Ihr Standardprojekt verweist.
Wenn Sie das Image-Repository aktualisieren möchten, in das die Projekt-Images verschoben werden sollen, gehen Sie so vor:
Öffnen Sie die Befehlspalette (drücken Sie Ctrl/Cmd+Shift + P) und führen Sie dann den Befehl Cloud Code: Auf Kubernetes ausführen aus.
Geben Sie an, ob Sie den aktuellen Kubernetes-Kontext zum Ausführen der Anwendung verwenden oder ob Sie zu einem bevorzugten Kontext wechseln möchten.
Sie werden aufgefordert, eine Image-Registry auszuwählen.
Geben Sie das Image-Repository ein, in dem Sie Ihre Bilder speichern möchten.
Im Abschnitt Gängige Image-Repository-Formate finden Sie Beispiele dafür, wie Sie für einige gängige Registrys angeben, wo Container-Images gespeichert werden.
Image-Namen erstellen
Cloud Code verkettet die Image-Registry mit dem Image-Namen, der in den Kubernetes-Manifesten angegeben ist, um den Namen des endgültigen Image-Repositorys zu generieren.
Diese Auswahl wird in Ihrer Startkonfiguration cloudcode.kubernetes gespeichert (in .vscode/launch.json).
Anschließend erstellt Cloud Code Ihre Container, überträgt sie in die Registry, wendet Kubernetes-Konfigurationen auf den Cluster an und wartet auf den Rollout.
Gängige Image-Repository-Formate
Im Folgenden finden Sie Beispiele, wie Sie für einige gängige Registrys angeben, wo Container-Images gespeichert werden:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eCloud Code requires you to define a container image repository to run or debug applications on a remote Kubernetes cluster, but this is not needed for local clusters like minikube or Docker Desktop.\u003c/p\u003e\n"],["\u003cp\u003eIf you're logged into Google Cloud and have a default project, Cloud Code automatically uses \u003ccode\u003egcr.io/PROJECT_ID\u003c/code\u003e as your default container image repository.\u003c/p\u003e\n"],["\u003cp\u003eYou can change the image repository by using the "Cloud Code: Run on Kubernetes" command, which will prompt you to select a new registry and store this preference in your \u003ccode\u003ecloudcode.kubernetes\u003c/code\u003e launch configuration.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code will build containers, push them to the specified registry, and apply Kubernetes configurations to the cluster, then waiting for the rollout to occur.\u003c/p\u003e\n"],["\u003cp\u003eCommon image repository formats include examples for Docker Hub, Artifact Registry, AWS Elastic Container Registry (ECR), and Azure Container Registry (ACR), each with their specific structure for image storage.\u003c/p\u003e\n"]]],[],null,["# Store your container images in Cloud Code for Cloud Shell\n\nTo run or debug an application on a remote Kubernetes cluster, you'll need to\ndefine the container image repository for your project. You can use any image\nrepository provider, including [Artifact Registry](/artifact-registry/docs).\n\nSpecify where container images are stored\n-----------------------------------------\n\nIf you're logged into Google Cloud in your IDE and you have a\ndefault project defined, Cloud Code automatically uses your\ndefault container image repository\n**gcr.io/\u003cvar class=\"readonly\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e** , where\n\u003cvar class=\"readonly\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e references your default project.\n| **Note:** If you are running on a local cluster like minikube or Docker Desktop, you do not need to specify these configurations.\n\nIf you'd like to update the image repository where the project\nimages are pushed, follow these instructions:\n\n1. Open the Command Palette (press `Ctrl`/`Cmd`+`Shift`+`P`) and then run the **Cloud Code: Run on Kubernetes** command.\n2. Confirm whether to use the current [Kubernetes context](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) to run the app in (or switch to a preferred one).\n3. You are prompted to select an image registry.\n4. Enter the image repository you want to store your images in.\n\n If your project has [Artifact Registry API enabled](/artifact-registry/docs/enable-service)\n and at least one [Artifact Registry repository](/artifact-registry/docs/manage-repos),\n you can browse to and select an existing Artifact Registry repository.\n\nSee the [common image repository formats](#image_formats) section for examples\nof how to specify where container images are stored for some common registries.\n\n### Image name creation\n\nCloud Code concatenates the image registry with the image name\nspecified in the Kubernetes manifests to generate the final image repository\nname.\n\nFor more information, see the\n[image registry handling guide](https://skaffold.dev/docs/environment/image-registries).\n\nThis choice is stored in your `cloudcode.kubernetes` launch configuration\n(found in .vscode/launch.json).\n\n\nCloud Code builds your containers, pushes them to the registry,\napplies Kubernetes configurations to the cluster, and waits for the rollout.\n\n### Common image repository formats\n\nHere are examples of how to specify where container images are stored for some\ncommon registries:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Create and configure a GKE cluster](/code/docs/shell/create-configure-gke-cluster).\n- Learn more about [Artifact Registry](/artifact-registry/docs/overview)."]]