Container-Optimized OS 使用主动-被动根分区方案。操作系统映像会完全更新,包括内核在内,而不是像传统 Linux 发行版那样逐个程序包进行更新。提供的映像已启用自动更新功能;也就是说,默认的 Container-Optimized OS 实例始终会下载发布的最新操作系统版本并将其安装在非活跃分区中。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eContainer-Optimized OS images can automatically update to newer versions for security and bug fixes, but this feature is disabled by default in milestone 117 and later.\u003c/p\u003e\n"],["\u003cp\u003eAutomatic updates are managed by default when Container-Optimized OS is used with managed services like Google Kubernetes Engine or Cloud SQL.\u003c/p\u003e\n"],["\u003cp\u003eUsers who need controlled kernel upgrades and rollouts should disable automatic updates.\u003c/p\u003e\n"],["\u003cp\u003eAutomatic updates can be enabled or disabled on new instances, existing instances, or all instances within a project using the \u003ccode\u003ecos-update-strategy\u003c/code\u003e metadata flag.\u003c/p\u003e\n"],["\u003cp\u003eCertain older Container-Optimized OS image versions released before specific key rotations cannot be automatically updated and require manual recreation with newer images.\u003c/p\u003e\n"]]],[],null,["# Automatic updates\n\nContainer-Optimized OS images have the built-in capability to automatically\nupgrade to a newer version when released. This capability, when enabled, allows\nuser instances to stay up-to-date with respect to security fixes and bug fixes.\n\nWhen Container-Optimized OS is used as part of a managed service (for example,\nGoogle Kubernetes Engine, Cloud SQL, etc.), the managed service takes care of updating\nthe Container-Optimized OS instance for the users. So, automatic updates are\ndisabled on those by default.\n\nUsers running production workloads that are sensitive to kernel upgrades and\nrequire controlled qualification and rollout should also disable automatic\nupdates. For more information, see the [Disabling automatic updates](#disabling_automatic_updates)\nsection.\n| **Note:** In-place updates are not supported on Container-Optimized OS VMs with Unified Extensible Firmware Interface (UEFI) Secure Boot enabled. UEFI Secure Boot is not enabled on Container-Optimized OS VMs by default. To learn more about UEFI Secure Boot, see the [Shielded VM documentation](/security/shielded-cloud/shielded-vm#secure-boot).\n| **Note:** In-place updates are not supported on Container-Optimized OS Arm-based images.\n\nEnable or disable automatic updates\n-----------------------------------\n\nIn milestone 117 and later, the automatic updates feature is disabled by default\non all Container-Optimized OS images. In milestones earlier than 117, the\nfeature is enabled by default. You can enable or disable automatic updates by\nsetting the `cos-update-strategy` metadata on new instances, existing instances,\nor on all instances in a project, as described in the following sections.\n\n### Configure auto-updates on a new instance\n\nCreate a new instance with automatic updates enabled: \n\n gcloud compute instances create \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --metadata cos-update-strategy=update_enabled\n\nCreate a new instance with automatic updates disabled: \n\n gcloud compute instances create \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --metadata cos-update-strategy=update_disabled\n\n### Configure auto-updates on an existing instance\n\nEnable automatic updates for an existing instance: \n\n gcloud compute instances add-metadata \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --metadata cos-update-strategy=update_enabled\n\nDisable automatic updates for an existing instance: \n\n gcloud compute instances add-metadata \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --metadata cos-update-strategy=update_disabled\n\n### Configure auto-updates on all instances in a project\n\nStarting from [milestone 97](/container-optimized-os/docs/release-notes/m97),\nyou can enable or disable auto-updates for all instances in a project using\nmetadata flags in project metadata.\n\nEnable updates for all instances in a project: \n\n gcloud compute project-info add-metadata \\\n --metadata cos-update-strategy=update_enabled\n\nDisable updates for all instances in a project: \n\n gcloud compute project-info add-metadata \\\n --metadata cos-update-strategy=update_disabled\n\n| **Note:** Metadata flags defined at the instance level take precedence over metadata flags defined at project level.\n\nAutomatic update design\n-----------------------\n\nContainer-Optimized OS uses an active-passive root partition scheme. The OS\nimage is updated in its entirety, including the kernel, as opposed to\npackage-by-package updates like on traditional Linux distributions. The image\nships with the automatic updates feature enabled; this means that a default\nContainer-Optimized OS instance always downloads the latest OS version and\ninstalls it on the passive partition soon after it's released.\n\nIf you are using\nan image from [LTS milestone](/container-optimized-os/docs/concepts/versioning#lts_milestones)\nor cos-stable image family, then you will get an update of the latest OS version\nfrom the same milestone. On cos-dev and cos-beta image family, the update will\nbe the latest OS version from the corresponding image family.\n| **Note:** The update does not take effect until the instance is rebooted, and the auto-updater does not force reboot when an update is installed. After an updated version has been installed, the instance must be rebooted before it can update to a newer version.\n\n### Changes to automatic update behavior\n\nThe Container-Optimized OS team is actively working on improving our backend\ninfrastructure that makes automatic updates possible. As part of these changes,\nwe are rotating the keys used to sign and validate the update payloads. However,\nimages released before the key rotation cannot be automatically updated to\nimages released after the rotation. The affected list of images are as followings:\n\n- These images cannot be updated to latest versions:\n\n - On Milestone 77: images prior to cos-77-12371-1000-0\n - On Milestone 81: images prior to cos-81-12871-1000-0\n - On Milestone 85: images prior to cos-85-13310-1000-0\n - On Milestone 86: images prior to cos-dev-86-15053-0-0\n- These images will no longer receive any updates:\n\n - All milestones before 77, including any previously deprecated milestones.\n\nUsers running standalone Container-Optimized OS with any of the affected versions, and\nhaving the auto-update feature enabled, will not see their instances being updated to newer versions.\nIn these cases, users should manually choose newer OS versions by recreating their\nVM instances with the newer image. Automatic updates will continue to work on all supported\nmilestones for new releases.\n| **Note:** Users using Container-Optimized OS as part of a managed service (for example, Google Kubernetes Engine, Cloud SQL, etc.) are not affected."]]