我用来启动注册表镜像的命令是
docker run -d --restart=always -p 5000:5000 --name registry-mirror -v /Users/proxycache/docker-proxy-cache/data:/var/lib/registry -v /Users/proxycache/docker-proxy-cache/config:/etc/docker/registry registry:2
我的配置看起来像
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
delete:
enabled: true
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
proxy:
remoteurl: https://registry-1.docker.io
我没有设置任何证书,因为这只是本地的,并没有绑定到域。
启动后我可以运行curl -I http://proxycache.local:5000/v2/
而我
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Mon, 20 Feb 2017 17:52:21 GMT
我也可以curl http://proxycache.local:5000/v2/_catalog
运行
{"repositories":[]}
然后我使用此命令minikube start --vm-driver=xhyve --disk-size=40g --memory=8192 --registry-mirror http://proxycache.local:5000 --insecure-registry http://proxycache.local:5000
eval $(minikube docker-env)
如果我运行docker info
,我会
Containers: 59
Running: 22
Paused: 0
Stopped: 37
Images: 15
Server Version: 1.11.1
Storage Driver: overlay
Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host
Swarm:
NodeID:
Is Manager: false
Node Address:
Init Binary:
containerd version:
runc version:
init version:
Kernel Version: 4.7.2
Operating System: Buildroot 2016.08
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.797 GiB
Name: minikube
ID: JGCU:HKNT:AOEL:PRNQ:DRNE:OQAM:2PI2:HSOD:VBPW:4LIN:BHIL:JDOF
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: bot
Registry: https://index.docker.io/v1/
Labels:
provider=xhyve
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
http://proxycache.local:5000/
Live Restore Enabled: false
它所说的部分
Registry Mirrors:
http://proxycache.local:5000/
似乎表明minikube设置正确
如果我运行docker pull busybox:latest
,它会下载图像,但不会更新镜像。如果我拉出目录curl http://proxycache.local:5000/v2/_catalog
,它仍然是空的
我还缺少什么?
根据请求,这是我从docker logs registry-mirror
time="2017-02-20T15:15:34Z" level=warning msg="No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable." go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="redis not configured" go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="Starting upload purge in 50m0s" go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="using inmemory blob descriptor cache" go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="Starting cached object TTL expiration scheduler..." go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="Registry configured as a proxy cache to https://registry-1.docker.io" go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
time="2017-02-20T15:15:34Z" level=info msg="listening on [::]:5000" go.version=go1.6.3 instance.id=f9fc5ef5-0faa-4bdb-b2ef-e5d10d5d5be5 version=v2.5.1
答案 0 :(得分:0)
所以似乎docker或者coreos不喜欢我们设置DNS的方式。我最终不得不使用镜像的IP地址而不是DNS名称,现在它可以工作。