davedoesdev / dxf

Docker registry v2 client in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problem while downloading blobs named using set-alias

twanc opened this issue · comments

LAYERSDIG=""

for LAYERDIGEST in dxf get-alias ubuntu latest; do
LAYERSDIG+="${LAYERDIGEST} "
done

dxf set-alias ubuntu releaseN ${LAYERSDIG}

$ docker pull localhost:5000/ubuntu:releaseN
releaseN: Pulling from ubuntu
87192bdbe00f: Already exists
28e09fddaacb: Already exists
7e15ce58ccb2: Already exists
a3ed95caeb02: Already exists
invalid character '\x1f' looking for beginning of value

it looks it is by design due to docker registry design, am I right? :)

Trying to repro this but I can't even get it to auth to Docker Hub at the moment :(

OK now I pulled the latest registry:2, I'm getting test failures.
Looks like Docker changed things around again. I did update to schema v2 but maybe it changed again :(

Ah no, scratch that the tests pass, I had a debugging line affecting the results.
So back to Docker Hub auth...

I can auth (even as anon) if I specify library/ubuntu instead of ubuntu.

@twanc are you using Docker Hub here or a private registry?
dxf really expects to be reading something it's written. It doesn't handle manifest lists, for example.

@davedoesdev
Thank you for response. I am using private docker registry deployed as following:
docker run -d -p 5000:5000 --restart=always --name registry registry:2

Afterwards I set shell environment as following:
export DXF_HOST=localhost:5000
export DXF_INSECURE=1

I checked deeper this case, especially logs from docker registry. Noticed the problem is while docker registry translating v2 manifest to v1 version because it is gathered via name - not the digest.
Anyway I noticed also it is all about manifest digest in config section. I changed this digest to the original once (for latest tag) and there is no problem to PUT it and download image at all.

OK thanks. I'd like to look a bit deeper into this too. How did you upload Ubuntu image to the local registry?

docker tag ubuntu localhost:5000/ubuntu
docker push localhost:5000/ubuntu

?

yes, exacly

My docker client version:
tomek@wro182:~/cloud-init-template$ docker --version
Docker version 1.10.3, build 20f81dd

OK I repro'd. Yes the cause is the manifest, but not because it's converting.
Schema 2 (https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md) has a config section which is supposed to contain the container config.
dxf is just using the registry as a blob store, it doesn't even know about containers. But the registry wants this section.
So to give it something, instead of an application/vnd.docker.container.image.v1+json to describe a container config, dxf just gives it an application/octet-stream (actually, points to the first layer itself).
docker pull will be trying to read that file as application/vnd.docker.container.image.v1+json and failing.

There's not much I can do here - I don't really want to start defining container image definitions just to store blobs.

yes, thats right, thanks for answer :)

No problem - I appreciate you reporting it and helping figure it out.

@davedoesdev I got bitten by this issue as well, as I was planning to use dxf to forward images between registries.
Can you add a "caveat" to the readme that this is currently not possible?

Nice suggestion - done and thanks!