ARTIFACTORY: Ancesstor of level 2 does not exist for manifest.json Error
Introduction
This document addresses an issue that occurs when attempting to list Docker repositories using the REST API. You may encounter the following error:
You may encounter the following error when running the List Docker Repositories REST API:
curl -u <USERNAME>:<PASSWORD> https://<ART_URL>/artifactory/api/docker/REPO-KEY/v2/_catalog
{
"errors": [
{
"status": 400,
"message": "Ancesstor of level 2 does not exist for manifest.json."
}
]
}
The error message "Ancestor of level 2 does not exist for manifest.json." indicates an issue with the way Docker image manifests are structured within the repository. This typically happens when Artifactory expects a specific manifest organization, but a required component is either missing or incorrectly positioned, preventing the Docker API from returning the expected results.
This error often occurs when a manifest.json file is placed at the root level of the repository. Each Docker image tag should have its own manifest file. When a manifest.json is incorrectly stored at the root level, it becomes unusable by the Docker client and leads to issues with the catalog API.
Resolution
To resolve this issue, locate the manifest.json file at the root level of the repository and remove it. The manifest.json should only be associated with image tags and not stored globally at the root level.
Once deleted, the API call should successfully list the repositories without the 400 error.
curl -u <username>:<passsword> https://<ART-URL>/artifactory/api/docker/<REPO-KEY>/v2/_catalog
{
"repositories": [
"tomcat"
]
}