2015-12-15 46 views
3

当我运行docker info,它显示了这样的信息:如何改变“注册表”值,显示了从“搬运工信息”

~ $ docker info 
Containers: 0 
Images: 8 
Server Version: 1.9.1 
Storage Driver: aufs 
Root Dir: /mnt/sda1/var/lib/docker/aufs 
Backing Filesystem: extfs 
Dirs: 9 
Dirperm1 Supported: true 
Execution Driver: native-0.2 
Logging Driver: json-file 
Kernel Version: 4.1.13-boot2docker 
Operating System: Boot2Docker 1.9.1 (TCL 6.4.1); master : cef800b - Fri Nov 20 19:33:59 UTC 2015 
CPUs: 1 
Total Memory: 1.956 GiB 
Name: default 
ID: CXQT:PB43:QNMD:W5JY:66QM:QRI7:GJUB:X27R:RQ4U:53I2:QVJS:DYKV 
Debug mode (server): true 
File Descriptors: 17 
Goroutines: 29 
System Time: 2015-12-15T06:26:35.824197223Z 
EventsListeners: 1 
Init SHA1: 
Init Path: /usr/local/bin/docker 
Docker Root Dir: /mnt/sda1/var/lib/docker 
Username: freewind 
Registry: https://index.docker.io/v1/ 
Labels: 
provider=virtualbox 

您可以在底部发现有一个Registry

Registry: https://index.docker.io/v1/ 

我想知道修改这个值,比如,将其更改为http://localhost:5000,所以它总是从http://localhost:5000拉的图像?


PS:我已经尝试添加--engine-registry-mirror http://localhost:5000创建泊坞窗机时:

docker-machine create -d virtualbox \ 
    --engine-registry-mirror http://localhost:5000 default 

而且在机器的/mnt/sda1/var/lib/boot2docker/profile,它所包含的内容:

EXTRA_ARGS=' 
--label provider=virtualbox 
--registry-mirror http://localhost:5000 

' 

为了要求它首先从http://localhost:5000中拉出图像。但我仍然不知道如何改变全球Registry值(docker info所示)

回答

1

如何改变全球注册表值(以泊坞窗信息显示)

这似乎固定在registry/config.go#L30-L31

// IndexServer is the v1 registry server used for user auth + account creation 
    IndexServer = DefaultV1Registry + "/v1/" 

请注意,注册表服务will first look for v2 endpoint anyway

func (s *Service) lookupEndpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) { 
    endpoints, err = s.lookupV2Endpoints(repoName) 

Issue 16974问:“为什么不把镜子支持私人V2注册表到现在?”

没有深入细节,这里的主要问题是信任和出处。基本上,注册表控制命名,因此一旦将守护进程指向另一个注册表,如果层发生冲突,就不能再信任内容。我们通过禁止任意镜像来避免这些问题。

这是我们正在努力解决的情况,但它会采取一些努力妥善解决。

更具体地,这之后在distribution PR 1136,与Proxying to other Registries

上拉通过缓存模式存在注册表,但从搬运工客户端内限制为仅反映官方泊坞Hub
当在配送项目中指定并实施图像出处时,可以扩展此功能。

现在,您所能做的就是添加--disable-legacy-registry以确保只考虑V2版本。这不会改变docker info输出。

+0

谢谢,我试着添加'--disable-legacy-registry',但它报告这个标志不被支持。我的码头版本是'Docker版本1.9.1,构建a34a1d5',是否添加到最新的码头代码库中? – Freewind

+0

@Freewind这是Docker守护程序CLI的一个选项:https://docs.docker.com/engine/reference/commandline/daemon/。所以它在docker 1.9.1中得到了支持。 – VonC