Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAME_UNKNOWN when listing tags of partially pushed image #777

Closed
so0k opened this issue Jul 29, 2015 · 10 comments
Closed

NAME_UNKNOWN when listing tags of partially pushed image #777

so0k opened this issue Jul 29, 2015 · 10 comments

Comments

@so0k
Copy link

so0k commented Jul 29, 2015

/v2/_catalog end point returned the repository but upon listing the tags I received:

{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"so0k/gitreceive"}}]}
docker/registry/v2/repositories# tree -L 2
.
├── so0k
│   ├── gitreceive <<< repository is here, but only partially pushed.
│   ├── gitreceive-dind
│   └── sinopia
└── test
    ├── api
    ├── web
    ├── worker
    └── ws

I fixed it by pushing the repository and making sure the push completed. Not sure what expected behavior is?

@dmp42
Copy link
Contributor

dmp42 commented Jul 29, 2015

ping @pdevine

@stevvooe
Copy link
Collaborator

@so0k It looks like there may be a bug here. Could you provide us a full output of tree? I'd like to see how "valid" so0k/gitreceive and if we can detect that and not expose it in the catalog.

There really isn't a strong guarantee that the repository exists if listed. From the specification:

Subsequently, the presence of a repository in the catalog listing only means that the registry may provide access to the repository at the time of the request. Conversely, a missing entry does not mean that the registry does not have the repository. More succinctly, the presence of a repository only guarantees that it is there but not that it is not there.

Albeit, even this wording isn't strongly guaranteed. Proper client code should be handle the NAME_UNKNOWN error, treating it as an empty or untagged repository.

@pdevine
Copy link

pdevine commented Jul 30, 2015

The catalog just looks to see if there are _layers directory in the directory walk and makes the assumption that if it exists, it's a valid repository. @stevvooe, is there a way of guaranteeing that each of the layers have been pushed and that everything is consistent? (Would we want that?)

@stevvooe
Copy link
Collaborator

@pdevine The paths are documented here. A valid repository would have either "_layers" or "_manifests".

The correct return for the tags API might be to have no tags, rather than NAME_UNKNOWN.

@Deshke
Copy link

Deshke commented Jul 31, 2015

running in the same bug, but my images are fully pushed - so maybe either the curl is buggy or the registry is bogus

curl -v  http://localhost:5000/v2/smt/tags/list
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 5000 (#0)
> GET /v2/smt/tags/list HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:5000
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Docker-Distribution-Api-Version: registry/2.0
< Date: Fri, 31 Jul 2015 09:59:09 GMT
< Content-Length: 111
< Content-Type: text/plain; charset=utf-8
< 
{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"smt"}}]}
* Connection #0 to host localhost left intact
/data/registry/docker/registry/v2/repositories # tree  -d -L 6
.
└── smt
    ├── ingest_preview
    │   ├── _layers
    │   │   └── sha256
    │   │       ├── 6e471a4b88178d29a20e9a2caaa1aac06ff9c62b97a0c882a5d97f99fc138cc4
    │   │       ├── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
    │   │       ├── c78d17052e177eee6518903c9ee885c5980fbaad5d42777b1521b6417c00398b
    │   │       └── da24b8f756263014a24b9d1676b6153dd573a4cd56a5039bf744dc698d01bba3
    │   ├── _manifests
    │   │   ├── revisions
    │   │   │   └── sha256
    │   │   │       └── ccb90a206b4ef40fee0fa8f334001f0a6923fb0df3a712f94af9e2b5a9adb7b0
    │   │   └── tags
    │   │       └── 01b0a80
    │   │           ├── current
    │   │           └── index
    │   └── _uploads
    └── videoengine_preview
        ├── _layers
        │   └── sha256
        │       ├── 22b5bc0143d369d3361379a947edddacf12e6a446df5e4354b29971265e83c50
        │       ├── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
        │       └── e31ae55786c2adb12ce73d0460f778db38af1d7506ab848f83366d2b138263c5
        ├── _manifests
        │   ├── revisions
        │   │   └── sha256
        │   │       └── 402a423e72414f2bf4bdbe182f12d8cefda8b0cbe26c3023377040a640b6d529
        │   └── tags
        │       └── v0.1
        │           ├── current
        │           └── index
        └── _uploads

update: registry started with

registry:
  image: registry:2
  restart: always
  ports:
    - 127.0.0.1:5000:5000
  environment:
    REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data/registry
  volumes:
    - /data/registry:/data/registry

@stevvooe
Copy link
Collaborator

@Deshke This is not the same issue, nor is it a bug. The curl command http://localhost:5000/v2/smt/tags/list is requesting information for the repository smt, which does not exist.

You need to either request http://localhost:5000/v2/smt/ingest_preview/tags/list or http://localhost:5000/v2/smt/videoengine_preview/tags/list.

@Deshke
Copy link

Deshke commented Jul 31, 2015

@stevvooe ah ok, then i missed the documentation on that part

@so0k
Copy link
Author

so0k commented Aug 3, 2015

Sorry for not providing you the exact folder structure of my registry storage as I had fixed the issue by pushing the problem image again. I will try to reproduce by doing another push and aborting mid-way.

@ywk253100
Copy link
Contributor

I got the same error "NAME_UNKNOWN" when listing tags of one repository which had not been pushed completely, but catalog API can list it.

@RichardScothern
Copy link
Contributor

There is no guarantee that a partially uploaded repository is valid due to the current storage system.

This particular case is being tracked in #936 and I'm going to close this issue in favour of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants