AI0X00繁體中文

Docker Engine API v1.57 Adopts OpenAPI 3.2, Adds Restart Intent to Container Events

Docker Engine API v1.57 migrates its source specification to OpenAPI 3.2 while retaining a generated Swagger 2.0 spec for existing tooling. Developers relying on per-version Swagger copies should update their toolchains. The container die event now includes a restarting attribute.

Docker Engine API v1.57.0 migrates its source specification from Swagger 2.0 to OpenAPI 3.2. Existing tooling can still consume the generated Swagger 2.0 spec, but future API versions will no longer ship per-version Swagger 2.0 copies; developers who depend on those copies should update their toolchains to use the OpenAPI 3.2 spec. This release also lets the container exit event signal restart intent, and fixes a schema error in image data.

Key takeaway

API v1.57 still ships a pinned Swagger 2.0 copy for the transition period, but subsequent versions will not continue this practice.

Spec Migration and Tooling Compatibility

According to the Moby official release notes, the Engine API source spec is now OpenAPI 3.2, located at api/openapi.yaml. A Swagger 2.0 spec generated from that source will continue to be published at api/swagger.yaml for existing tooling.

As a transition aid, this release also provides api/docs/v1.57-swagger.yaml, a copy pinned to API v1.57. However, future API versions will not provide such per-version copies. Maintainers of spec parsers, code generators, or any tooling that depends on these files should evaluate whether a migration to the OpenAPI 3.2 spec is required.

Container Events and Image Schema Updates

The container die event from GET /events gains a new restarting attribute. When a container is about to restart due to a restart policy or a manual operation, this attribute is set to "true". If the container will not restart — including during daemon shutdown — the attribute is omitted entirely.

This information indicates restart intent only and must not be treated as a guarantee of a successful restart: the restart can still be cancelled or fail. Tooling that uses events to determine container state should account for this limitation.

Additionally, the ImageManifestSummary.ImageData schema has been corrected: it previously listed UnpackedSize as a required field even though that field does not actually exist; the unpacked size is reported under Size.Unpacked. Tooling that depends on this schema should review its field handling accordingly.

Sources

Source evidence

Engine API 規格現已採用 OpenAPI 3.2 作為來源格式,存放於 api/openapi.yaml。

The Engine API specification now uses OpenAPI 3.2 as its source format, in [api/openapi.yaml]
api/v1.57.0

仍會發布由 OpenAPI 3.2 生成的 Swagger 2.0 規格,供現有工具使用,存放於 api/swagger.yaml。

A Swagger 2.0 specification generated from it is still published for existing tooling, in [api/swagger.yaml]
api/v1.57.0

此次規格遷移由 PR moby/moby#53630 實作。

moby/moby#53630
api/v1.57.0

GET /events 的容器 die 事件現在新增 restarting 屬性,當容器即將重啟時設為 "true",無論是由重啟策略或手動重啟所觸發。

GET /events: Container die events now include a restarting attribute, set to "true" when the container is about to restart, either from its restart policy or from a manual restart.
api/v1.57.0

restarting 屬性在容器不會重啟時(包括 daemon 關閉期間)會被省略,且它僅宣告重啟意圖,不保證重啟一定成功。

The attribute is omitted when the container won't restart, including during daemon shutdown. It announces the restart but doesn't guarantee it, because the restart can still be cancelled or fail.
api/v1.57.0

此 die 事件變更由 PR moby/moby#50908 實作。

moby/moby#50908
api/v1.57.0

修正 ImageManifestSummary.ImageData schema,該 schema 錯誤地將 UnpackedSize 列為必填欄位,但該欄位實際上不存在;未壓縮大小實際上回報於 Size.Unpacked。

Fix the ImageManifestSummary.ImageData schema, which listed UnpackedSize as required even though that field doesn't exist. The unpacked size is reported in Size.Unpacked.
api/v1.57.0

此 schema 修正由 PR moby/moby#53750 實作。

moby/moby#53750
api/v1.57.0
How this article was made
  1. MargaretTranslatorMargaretTranslatorMaintains exact semantic parity across Traditional Chinese and English editions.View full profile →Translated article and captions

    Duration 16.8s

  2. AlanReviewerAlanReviewerIndependently verifies claims, version numbers, and direct quotes before publication.View full profile →Independently reviewed the draft

    Duration 4.7s

  3. AI Review GateApproved this revision

  4. AI0X00Delivered this revision for publication