我按照这指南设置了一个Docker v2注册表,作为Docker映像的本地代理缓存。我的Docker守护进程配置了指向同一个注册表实例的--insecure-registry和--registry-mirror选项。
当拖放图像时,它通过将图像缓存到本地商店来正确工作。
问题是,当我试图将图像推送到这样的本地私有注册表时,我会得到一个奇怪的UNSUPPORTED错误。登记册上写着:
time="2015-11-09T13:20:22Z" level=error msg="response completed with error" err.code=UNSUPPORTED err.message="The operation is unsupported." go.version=go1.4.3 http.request.host="my.registry.io:5000" http.request.id=b1faccb3-f592-4790-bbba-00ebb3a3bfc1 http.request.method=POST http.request.remoteaddr="192.168.0.4:57608" http.request.uri="/v2/mygroup/myimage/blobs/uploads/" http.request.useragent="docker/1.9.0 go/go1.4.2 git-commit/76d6bc9 kernel/3.16.0-4-amd64 os/linux arch/amd64" http.response.contenttype="application/json; charset=utf-8" http.response.duration=2.035918ms http.response.status=405 http.response.written=78 instance.id=79970ec3-c38e-4ebf-9e83-c3890668b122 vars.name="mygroup/myimage" version=v2.2.0如果我禁用注册表上的代理设置,则推送将正确工作。我是在配置中遗漏了什么,还是只是私有注册中心不能同时充当代理缓存?
发布于 2015-11-09 19:42:20
我自己就碰到这个了。结果显示,不支持将其推送到配置为代理的私有注册表。看见
https://docs.docker.com/registry/configuration/#proxy
“当前不支持向配置为拉通缓存的注册表推送”。
那太可惜了。现在,我将不得不将本地代理缓存设置为单独的注册表。
发布于 2021-04-23 01:38:42
@Konrad已经和解释联系起来了。
我的解决方案要求注册表将其图像保存在一个码头卷上,这样即使在我杀死和丢弃容器时,它们仍然是可用的。
# run proxy registry persisting images on local host
docker stop registry
docker rm registry
docker run -d -p 5000:5000
-v ~/.docker/registry:/var/lib/registry \
--name registry \
registry:2
docker push localhost:5000/your-image:your-tag
# --> see successful push happening...
docker stop
docker rm registry
# re-run the registry as proxy, re-mounting the volume with the images
docker run -d -p 5000:5000 \
-e MIRROR_SOURCE=https://registry.example.net \
-e REGISTRY_PROXY_REMOTEURL=https://registry.example.net \
-e REGISTRY_PROXY_USERNAME="${REGISTRY_USER}" \
-e REGISTRY_PROXY_PASSWORD="${REGISTRY_PASSWORD}" \
-v ~/.docker/registry:/var/lib/registry \
--name registry \
registry:2这符合我通常的需要;我不知道你是否能像我那样扔掉容器(但理论上你应该这样;容器应该是短暂的)。
否则,您必须使用docker save your-image:your-tag > your-image.tar,将其传输到运行注册表的机器上,然后再传输到docker load -i your-image.tar。这并不理想,但应该有效。
https://stackoverflow.com/questions/33610215
复制相似问题