如何更改从“docker信息”显示的“registry”值
当我运行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:我已经尝试在创builddocker机器时添加--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
)
如何更改全局registry值(显示在docker信息中)
这似乎修复了registry/config.go#L30-L31
// IndexServer is the v1 registry server used for user auth + account creation IndexServer = DefaultV1Registry + "/v1/"
请注意,registry服务将首先查找v2端点 。
func (s *Service) lookupEndpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) { endpoints, err = s.lookupV2Endpoints(repoName)
问题16974问“为什么不直接镜像支持私人v2registry?”
没有深入细节,这里的主要问题是信任和出处。 基本上,registry控制命名,所以一旦你把守护进程指向另一个registry,如果层发生冲突,你就不能再信任这个内容。 我们通过禁止任意镜像来避免这些问题。
这是我们正在努力解决的一个情况,但需要一些努力来适当解决。
更具体地说,这在分配PR 1136中被跟随, 其他注册pipe理机构 :
registry存在一种直通式caching模式,但在Docker客户端中受到限制,只能镜像正式的Docker Hub 。
在分发项目中指定并实施图像出处时,可以扩展此function。
现在,你所能做的只是添加--disable-legacy-registry
,以确保只考虑V2。 这不会改变docker info
输出。