Files
Sebastiaan van Stijn 09689298e3 distribution: fix detection of v1 images and remove libtrust dependency
The current detection based on mediaType only accounted for the non-signed
mediatype (`application/vnd.docker.distribution.manifest.v1+json`), but
most (if not all) v1 images used the "signed" manifest type; for example;

    docker buildx imagetools inspect docker:1.0.1
    Name:      docker.io/library/docker:1.0.1
    MediaType: application/vnd.docker.distribution.manifest.v1+prettyjws
    Digest:    sha256:666987df8e0c46670ea52bcd078547297a738fd6b421ec77aac910e1c0f688fd

Various code-paths would still detect the unsupported type through type-
matching the `*schema1.SignedManifest` type, but given that the only reason
for this is to detect whether the image is supported, we might as well just
match the mediaType.

Unfortunately, the [containerd images package][1] currently only defines a
const for the signed variant, and not for the unsigned ones, so to remove
the dependency on the `schema1` package, this patch introduces a (temporary)
local definition.

With this patch, the dependency on the "schema1" package is removed, and with
that also the use of "libtrust"; the dependency still shows up in vendor.mod
due to the docker/distribution dependency not being a go module, but should
dissolve once we remove that dependency in future.

This patch can also be verified using the `distribution` endpoint, which
returns an error when trying to get information for a "v1" image;

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:1.0.1/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:1.0.1/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 400 Bad Request
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:00:18 GMT
    < Content-Length: 311
    {"message":"Docker Image Format v1 and Docker Image manifest version 2, schema 1 support has been removed. Suggest the author of docker.io/library/docker:1.0.1 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/"}

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:28/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:28/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:01:06 GMT
    < Content-Length: 541
    {"Descriptor":{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:0a2ee60851e1b61a54707476526c4ed48cc55641a17a5cba8a77fb78e7a4742c","size":5165},"Platforms":[{"architecture":"amd64","os":"linux"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v6"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v7"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm64","os":"linux","variant":"v8"},{"architecture":"unknown","os":"unknown"}]}

[1]: https://github.com/containerd/containerd/blob/v2.1.3/core/images/mediatypes.go#L54-L55

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 19:57:10 +02:00
..
2022-01-18 15:46:04 +01:00
2022-01-18 15:46:04 +01:00
2016-11-03 15:31:46 -07:00
2019-02-14 04:47:27 +01:00
2016-11-03 15:31:46 -07:00
2022-01-18 15:46:04 +01:00
2019-02-14 04:47:27 +01:00
2022-01-18 15:46:04 +01:00

Distribution

The Docker toolset to pack, ship, store, and deliver content.

This repository provides the Docker Registry 2.0 implementation for storing and distributing Docker images. It supersedes the docker/docker-registry project with a new API design, focused around security and performance.

Circle CI GoDoc

This repository contains the following components:

Component Description
registry An implementation of the Docker Registry HTTP API V2 for use with docker 1.6+.
libraries A rich set of libraries for interacting with distribution components. Please see godoc for details. Note: These libraries are unstable.
specifications Distribution related specifications are available in docs/spec
documentation Docker's full documentation set is available at docs.docker.com. This repository contains the subset related just to the registry.

How does this integrate with Docker engine?

This project should provide an implementation to a V2 API for use in the Docker core project. The API should be embeddable and simplify the process of securely pulling and pushing content from docker daemons.

What are the long term goals of the Distribution project?

The Distribution project has the further long term goal of providing a secure tool chain for distributing content. The specifications, APIs and tools should be as useful with Docker as they are without.

Our goal is to design a professional grade and extensible content distribution system that allow users to:

  • Enjoy an efficient, secured and reliable way to store, manage, package and exchange content
  • Hack/roll their own on top of healthy open-source components
  • Implement their own home made solution through good specs, and solid extensions mechanism.

More about Registry 2.0

The new registry implementation provides the following benefits:

  • faster push and pull
  • new, more efficient implementation
  • simplified deployment
  • pluggable storage backend
  • webhook notifications

For information on upcoming functionality, please see ROADMAP.md.

Who needs to deploy a registry?

By default, Docker users pull images from Docker's public registry instance. Installing Docker gives users this ability. Users can also push images to a repository on Docker's public registry, if they have a Docker Hub account.

For some users and even companies, this default behavior is sufficient. For others, it is not.

For example, users with their own software products may want to maintain a registry for private, company images. Also, you may wish to deploy your own image repository for images used to test or in continuous integration. For these use cases and others, deploying your own registry instance may be the better choice.

Migration to Registry 2.0

For those who have previously deployed their own registry based on the Registry 1.0 implementation and wish to deploy a Registry 2.0 while retaining images, data migration is required. A tool to assist with migration efforts has been created. For more information see docker/migrator.

Contribute

Please see CONTRIBUTING.md for details on how to contribute issues, fixes, and patches to this project. If you are contributing code, see the instructions for building a development environment.

Support

If any issues are encountered while using the Distribution project, several avenues are available for support:

IRC #docker-distribution on FreeNode
Issue Tracker github.com/docker/distribution/issues
Google Groups https://groups.google.com/a/dockerproject.org/forum/#!forum/distribution
Mailing List docker@dockerproject.org

License

This project is distributed under Apache License, Version 2.0.