Container-Optimized OS 採用主動/被動的根分區配置。相對於傳統 Linux 發佈版本會逐個套件進行更新,OS 映像檔會包含核心一同進行完整更新。映像檔會啟用自動更新功能,這表示預設的 Container-Optimized OS 執行個體一律會下載最新的 OS 版本,並在發布後立即在被動分區上安裝。
如果您使用的是 LTS 里程碑或 cos-stable 映像檔系列的映像檔,則會收到來自相同里程碑的最新 OS 版本更新。在 cos-dev 和 cos-beta 映像檔系列中,更新內容會是對應映像檔系列的最新 OS 版本。
自動更新行為的變更
Container-Optimized OS 團隊正積極改善後端基礎架構,以便提供自動更新功能。為了推動這些變更,我們會輪替用於簽署及驗證更新酬載的金鑰。不過,在金鑰輪替前發布的圖片無法自動更新為輪替後發布的圖片。受影響的圖片清單如下:
以下映像檔無法更新至最新版本:
在里程碑 77 上:cos-77-12371-1000-0 之前的映像檔
在 81 個里程碑:cos-81-12871-1000-0 之前的映像檔
在 85 里程碑:cos-85-13310-1000-0 之前的映像檔
在里程碑 86 上:cos-dev-86-15053-0-0 之前的映像檔
以下圖片將不再收到任何更新:
77 之前的所有里程碑,包括先前已淘汰的里程碑。
使用者如果執行獨立的 Container-Optimized OS,且執行的是任何受影響的版本,並已啟用自動更新功能,就不會看到自己的執行個體更新為新版本。在這種情況下,使用者應手動選擇較新的 OS 版本,方法是使用較新的映像檔重新建立 VM 執行個體。自動更新功能將繼續支援所有新版本的支援里程碑。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]