Instanzen mit benutzerdefinierten Gastrichtlinien konfigurieren
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Container-Optimized OS enthält den OS Config-Agent. Sie können die Gastrichtlinien von OS Config verwenden, um Ihre Instanz zu konfigurieren. Die Features packages und packageRepositories von Gastrichtlinien werden im Container-Optimized OS nicht unterstützt.
Folgendes Beispiel zeigt, wie Nutzer die Features assignment und recipes von Gastrichtlinien verwenden können, um eine Datei auf Instanzen in us-central1-a zu erstellen.
[[["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\u003eContainer-Optimized OS includes the OS Config agent, which allows instance configuration through guest policies.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epackages\u003c/code\u003e and \u003ccode\u003epackageRepositories\u003c/code\u003e features of guest policies are not supported on Container-Optimized OS.\u003c/p\u003e\n"],["\u003cp\u003eUsers can utilize the \u003ccode\u003eassignment\u003c/code\u003e and \u003ccode\u003erecipes\u003c/code\u003e features of guest policies to perform actions such as creating files on instances.\u003c/p\u003e\n"],["\u003cp\u003eUnlike other distros, Container-Optimized OS requires an \u003ccode\u003einterpreter\u003c/code\u003e to execute scripts in recipes and runs recipes on every boot due to the stateless nature of most directories.\u003c/p\u003e\n"],["\u003cp\u003eWhile it's optional to provide an \u003ccode\u003einterpreter\u003c/code\u003e on other distros, Container-Optimized OS requires it to execute the given script.\u003c/p\u003e\n"]]],[],null,["# Configuring instances with user-defined guest policies\n\nContainer-Optimized OS includes the\n[OS Config](/compute/docs/vm-manager)\nagent. You can use OS Config's [guest policies](/compute/docs/osconfig/rest/v1beta/projects.guestPolicies#resource:-guestpolicy) to configure your\ninstance. `packages` and\n`packageRepositories` features of guest policies are not supported on Container-Optimized OS.\n\nTo enable OS Config and create a guest policy, see [Enable OS Config\nagent](/compute/docs/manage-os#overview) and [Create a\nguest\npolicy](/compute/docs/os-config-management/create-guest-policy), respectively.\n\nHere is an example that shows how users can use `assignment` and `recipes`\nfeatures of guest policies to create a file on instances located at\nus-central1-a. \n\n assignment:\n zones:\n - us-central1-a\n recipes:\n - name: recipe-runscript\n desiredState: INSTALLED\n installSteps:\n - scriptRun:\n interpreter: SHELL\n script: touch /tmp/TOUCH_FILE\n\n| **Note:** While it is optional to provide an `interpreter` on other distros, Container-Optimized OS requires `interpreter` to execute the given script.\n| **Note:** While `recipes` are run once-per-instance on other distros, on Container-Optimized OS, `recipes` are run on every boot. This is because most of the directories are stateless; therefore, changes made by `recipes` will not persist across reboots. See [Disks and Filesystem](/container-optimized-os/docs/concepts/disks-and-filesystem) for more information on Container-Optimized OS's filesystem."]]