docker pull 私有仓库镜像报错问题


公司私有Registry正常运行几个月了,这几天pull突然就报错了(push没问题,search也没问题),google有人说开防火墙可能会遇到这问题,我环境防火墙一直都是关着的。

具体环境如下:
[root@vm13127 haichuan1]# uname -a
Linux vm13127.bx.sce.sina.com 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@vm13127 haichuan1]# docker version
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa/1.3.2
OS/Arch (client): linux/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa/1.3.2

[root@vm13127 haichuan1]# docker info
Containers: 9
Images: 273
Storage Driver: devicemapper
Pool Name: docker-253:1-262535-pool
Pool Blocksize: 65.54 kB
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 6.099 GB
Data Space Total: 107.4 GB
Metadata Space Used: 11.42 MB
Metadata Space Total: 2.147 GB
Library Version: 1.02.84-RHEL7 (2014-03-26)
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.el7.x86_64
Operating System: CentOS Linux 7 (Core)


执行命令如下:
[root@vm13127 haichuan1]# docker pull registry.docker.sce.sina.com/test:centos7
Pulling repository registry.docker.sce.sina.com/test
1b32009a9db6: Error pulling image (centos7) from registry.docker.sce.sina.com/test, Server error: Status 416 while fetching image layer (f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639) 3d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639) 
2015/05/06 20:22:42 Error pulling image (centos7) from registry.docker.sce.sina.com/test, Server error: Status 416 while fetching image layer (f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639)


registry log太长了,就不贴了,都是INFO日志,没有任何warning或err日志。

求解啊~~~
已邀请:

wangzi19870227 - sina攻城狮,docker爱好者

赞同来自: nicole


把这问题结一下。

@xds2000 ,把docker range相关部分代码检查了下,没发现什么问题。考虑可能是使用的registry driver的问题,调试了一通,registry和driver都没任何报错。

最后拿出的一个变通的解决方案:把后端存储方案换为dev+云硬盘。发现这种方式不仅可以实现同样的持久可靠存储后端,而且使得registry更易于部署,也不用依赖registry后端存储驱动了(有问题时还得去debug,相信大家都不想把精力与时间放在这个上面)。

so,如果你正想要玩玩registry,不妨先把玩一下dev+云硬盘这种方案,简单又可靠。

小飞侠 - TenxCloud合伙人

赞同来自:


私有registry是在容器里面run吗?如果是,可以重启容器试试。
还不行的话,如果Volume在host上,可以考虑重建容器。
如果还不行,只能看看docker源码了,docker/graph/pull.go里面报的错误,可以研究一下。

wangzi19870227 - sina攻城狮,docker爱好者

赞同来自:


是在容器里面run的,重启、重建都试过了;
源码pull.go也看了,主要是因registry/session.go中GetRemoteImageLayer执行http Get请求失败,但为什么会失败呢?其它docker操作都是ok的,Registry也运行正常,无任何报错。去后端存储上细细检查了镜像的相关存储文件,也都很正常。

docker pull时抓到的docker debug日志如下:
[debug] server.go:1181 Calling POST /images/create
[info] POST /v1.15/images/create?fromImage=registry.docker.sce.sina.com%2Ftest%3Acentos7
[e84cb07a] +job pull(registry.docker.sce.sina.com/test, centos7)
[debug] endpoint.go:59 Error from registry "https://registry.docker.sce.sina.com/v1/" marked as insecure: Get https://registry.docker.sce.sina.com/v1/_ping: dia
l tcp 10.13.131.23:443: connection refused. Insecurely falling back to HTTP
[debug] endpoint.go:137 Error unmarshalling the _ping RegistryInfo: json: cannot unmarshal bool into Go value of type registry.RegistryInfo
[debug] endpoint.go:141 Registry version header: '0.8.1'
[debug] endpoint.go:144 RegistryInfo.Version: "0.8.1"
[debug] endpoint.go:147 Registry standalone header: 'True'
[debug] endpoint.go:155 RegistryInfo.Standalone: true
[debug] session.go:266 [registry] Calling GET http://registry.docker.sce.sina.com/v1/repositories/test/images
[debug] http.go:162 http://registry.docker.sce.sina.com/v1/repositories/test/images -- HEADERS: map[User-Agent:[docker/1.3.2 go/go1.3.3 kernel/3.10.0-123.el7.x8
6_64 os/linux arch/amd64]]
[debug] pull.go:172 Retrieving the tag list
[debug] http.go:162 http://registry.docker.sce.sina.com/v1/repositories/library/test/tags -- HEADERS: map[User-Agent:[docker/1.3.2 go/go1.3.3 kernel/3.10.0-123.el7.x86_64 os/linux arch/amd64]]
[debug] session.go:222 Got status code 200 from http://registry.docker.sce.sina.com/v1/repositories/library/test/tags
[debug] pull.go:187 Registering tags
[debug] pull.go:210 () does not match centos7 (id: f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639), skipping
[debug] http.go:162 http://registry.docker.sce.sina.com/v1/images/1b32009a9db6fb56a60514fe6aae45d3281f492c3f5dc4988b4a8d92a0136f86/ancestry -- HEADERS: map[User-Agent:[docker/1.3.2 go/go1.3.3 kernel/3.10.0-123.el7.x86_64 os/linux arch/amd64]]
[debug] pull.go:210 () does not match centos7 (id: f1dade627e2541880e968459c4c3861678a8b576714f0325e16a7a04c32326c6), skipping
[debug] pull.go:210 () does not match centos7 (id: c43c1996cf187f30bc8af15e7a3bc5aee1eba2a0995baaf3e4135a7a676d74b1), skipping
[debug] session.go:95 Ancestry: ["1b32009a9db6fb56a60514fe6aae45d3281f492c3f5dc4988b4a8d92a0136f86", "f1dade627e2541880e968459c4c3861678a8b576714f0325e16a7a04c32326c6", "c43c1996cf187f30bc8af15e7a3bc5aee1eba2a0995baaf3e4135a7a676d74b1", "f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639"]
[debug] http.go:162 http://registry.docker.sce.sina.com/v1/images/f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639/json -- HEADERS: map[User-Agent:[docker/1.3.2 go/go1.3.3 kernel/3.10.0-123.el7.x86_64 os/linux arch/amd64]]
[debug] image.go:249 Json string: {{"id":"f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639","created":"2015-04-22T05:12:47.171582029Z","container":"df10d6e2cabfef344bcf4c236367695f95da8f1d9bbb80e69c88ec4f4d8744f1","container_config":{"Hostname":"df10d6e2cabf","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":["/bin/sh","-c","#(nop) MAINTAINER The CentOS Project \u003ccloud-ops@centos.org\u003e - ami_creator"],"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"MacAddress":"","OnBuild":null},"docker_version":"1.6.0","author":"The CentOS Project \u003ccloud-ops@centos.org\u003e - ami_creator","config":{"Hostname":"df10d6e2cabf","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"MacAddress":"","OnBuild":null},"architecture":"amd64","os":"linux","Size":0}
}
[debug] http.go:162 http://registry.docker.sce.sina.com/v1/images/f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639/layer -- HEADERS: map[User-Agent:[docker/1.3.2 go/go1.3.3 kernel/3.10.0-123.el7.x86_64 os/linux arch/amd64]]
Error pulling image (centos7) from registry.docker.sce.sina.com/test, Server error: Status 416 while fetching image layer (f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639)
[e84cb07a] -job pull(registry.docker.sce.sina.com/test, centos7) = ERR (1)

xds2000 - 数人科技CTO

赞同来自:


Error pulling image (centos7) from registry.docker.sce.sina.com/test, Server error: Status 416 while fetching image layer (f1b10cd842498c23d206ee0cbeaa9de8d2ae09ff3c7af2723a9e337a6965d639)

返回的报错是416,是http的status code, 416
'Range' specification sent by the client system.
你要看看

要回复问题请先登录注册