moby/daemon/containerd
Sebastiaan van Stijn 62b33a2604
disable pulling legacy image formats by default
This patch disables pulling legacy (schema1 and schema 2, version 1) images by
default.

A `DOCKER_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE` environment-variable is
introduced to allow re-enabling this feature, aligning with the environment
variable used in containerd 2.0 (`CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE`).

With this patch, attempts to pull a legacy image produces an error:

With graphdrivers:

    docker pull docker:1.0
    1.0: Pulling from library/docker
    [DEPRECATION NOTICE] Docker Image Format v1, and Docker Image manifest version 2, schema 1 support will be removed in an upcoming release. Suggest the author of docker.io/library/docker:1.0 to upgrade the image to the OCI Format, or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/

With the containerd image store enabled, output is slightly different
as it returns the error before printing the `1.0: pulling ...`:

    docker pull docker:1.0
    Error response from daemon: [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/docker:1.0 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/

Using the "distribution" endpoint to resolve the digest for an image also
produces an error:

    curl -v --unix-socket /var/run/docker.sock http://foo/distribution/docker.io/library/docker:1.0/json
    *   Trying /var/run/docker.sock:0...
    * Connected to foo (/var/run/docker.sock) port 80 (#0)
    > GET /distribution/docker.io/library/docker:1.0/json HTTP/1.1
    > Host: foo
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 400 Bad Request
    < Api-Version: 1.45
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Tue, 27 Feb 2024 16:09:42 GMT
    < Content-Length: 354
    <
    {"message":"[DEPRECATION NOTICE] Docker Image Format v1, and Docker Image manifest version 2, schema 1 support will be removed in an upcoming release. Suggest the author of docker.io/library/docker:1.0 to upgrade the image to the OCI Format, or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/"}
    * Connection #0 to host foo left intact

Starting the daemon with the `DOCKER_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE`
env-var set to a non-empty value allows pulling the image;

    docker pull docker:1.0
    [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/docker:1.0 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/
    b0a0e6710d13: Already exists
    d193ad713811: Already exists
    ba7268c3149b: Already exists
    c862d82a67a2: Already exists
    Digest: sha256:5e7081837926c7a40e58881bbebc52044a95a62a2ea52fb240db3fc539212fe5
    Status: Image is up to date for docker:1.0
    docker.io/library/docker:1.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-02-28 13:57:43 +01:00
..
cache.go image/cache: Check image platform 2024-01-25 16:04:05 +01:00
handlers.go Update cleanup logic to use resolve all images 2023-12-18 14:04:48 -08:00
image.go migrate image spec to github.com/moby/docker-image-spec 2024-02-09 19:12:18 +01:00
image_builder.go migrate image spec to github.com/moby/docker-image-spec 2024-02-09 19:12:18 +01:00
image_changes.go c8d/changes: Fix concurrents diffs 2023-10-13 13:15:50 +02:00
image_children.go c8d/cache: Optimize FROM scratch case 2024-01-17 14:57:53 +01:00
image_commit.go migrate image spec to github.com/moby/docker-image-spec 2024-02-09 19:12:18 +01:00
image_delete.go c8d: make the cache in classic builder work 2024-01-17 14:57:50 +01:00
image_delete_test.go Add support for removing repo and digest 2023-12-18 16:33:53 -08:00
image_events.go api/types/image: move GetImageOpts to api/types/backend 2024-01-22 20:45:21 +01:00
image_exporter.go c8d/save: Handle digested reference same as ID 2024-01-29 16:29:05 +01:00
image_history.go c8d: Use the same logic to get the present images 2024-02-06 16:35:53 +01:00
image_import.go migrate image spec to github.com/moby/docker-image-spec 2024-02-09 19:12:18 +01:00
image_import_test.go daemon/c8d: Use Docker imagespec 2023-08-31 17:15:05 +02:00
image_list.go c8d: Adjust "image list" to return only a single item for each image store entry 2024-02-14 18:44:37 +01:00
image_manifest.go pkg/platforms: internalize in daemon/containerd 2024-01-20 22:28:56 +01:00
image_prune.go Update cleanup logic to use resolve all images 2023-12-18 14:04:48 -08:00
image_pull.go disable pulling legacy image formats by default 2024-02-28 13:57:43 +01:00
image_push.go Default the auth config domain to the target image domain 2023-11-06 17:02:18 -08:00
image_snapshot.go c8d/snapshot: Create any platform if not specified 2024-01-22 16:15:07 +01:00
image_snapshot_unix.go Update commit id unmap to directly use active mounts 2023-12-22 10:14:44 -08:00
image_snapshot_windows.go Update commit id unmap to directly use active mounts 2023-12-22 10:14:44 -08:00
image_squash.go containerd-integration: prefer error over panic where possible 2022-09-07 22:01:49 +02:00
image_tag.go Update cleanup logic to use resolve all images 2023-12-18 14:04:48 -08:00
image_test.go Add support for removing repo and digest 2023-12-18 16:33:53 -08:00
imagespec.go migrate image spec to github.com/moby/docker-image-spec 2024-02-09 19:12:18 +01:00
mount.go daemon/c8d: Unmount container fs after unclean shutdown 2023-11-27 12:33:33 +01:00
platform_matchers.go pkg/platforms: internalize in daemon/containerd 2024-01-20 22:28:56 +01:00
progress.go c8d/pull: Don't emit Downloading with 0 progress 2024-02-22 18:03:16 +01:00
resolver.go Default the auth config domain to the target image domain 2023-11-06 17:02:18 -08:00
service.go Implement GetLayerFolders for the containerd image store 2024-01-17 16:29:28 +01:00
service_unix.go Implement GetLayerFolders for the containerd image store 2024-01-17 16:29:28 +01:00
service_windows.go Implement GetLayerFolders for the containerd image store 2024-01-17 16:29:28 +01:00
soft_delete.go Update cleanup logic to use resolve all images 2023-12-18 14:04:48 -08:00
store.go daemon/c8d: use new containerd LabelDistributionSource constant 2023-09-21 14:18:42 -06:00