예제 #1
0
Future<Manifest> RegistryClientProcess::getManifest(
    const Image::Name& imageName)
{
  http::URL manifestURL(registryServer_);
  manifestURL.path =
    "v2/" + imageName.repository() + "/manifests/" + imageName.tag();

  return doHttpGet(manifestURL, None(), false, true, None())
    .then(defer(self(), [this] (
        const http::Response& response) -> Future<Manifest> {
      // TODO(jojy): We dont use the digest that is returned in header.
      // This is a good place to validate the manifest.

      Try<Manifest> manifest = Manifest::create(response.body);
      if (manifest.isError()) {
        return Failure(
            "Failed to parse manifest response: " + manifest.error());
      }

      return manifest.get();
    }));
}
예제 #2
0
// Returns the path to the repository that is used to construct
// URL to call the Docker registry server.
// Currently we only support offical repositories that always prefix
// repository with library/.
// TODO(tnachen): Support unoffical repositories and loading in repository
// information.
string RegistryClientProcess::getRepositoryPath(
    const Image::Name& imageName) const
{
  return getAPIVersion() + "/library/" + imageName.repository();
}