【发布时间】:2015-10-31 00:17:11
【问题描述】:
我必须从我的注册表容器中连接到 Docker 主机(我的应用程序在 8080 上运行)。为此,我使用“--add-host”标志将 Docker 主机的 IP 地址传递给容器。关注github issue 和Command line reference。我在 config.yml 下面启用了我的应用程序端点:8080 以从注册表发送 webhook 通知。
这个设置一直有效,直到昨天我的应用程序在 docker 版本 1.8.2 中收到了各种推送/拉取事件通知。但是,它今天停止工作。我尝试从 1.8.2 升级到 1.8.3 以查看是否可以修复它,但到目前为止还没有运气。不确定这是否与任何 Docker 1.9 版本更新有关。
任何输入/建议/指针将不胜感激。
Docker 版本:
$ docker version
Client:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 06:06:01 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 06:06:01 UTC 2015
OS/Arch: linux/amd64
使用此命令启动注册表容器
$docker run -d -p 5000:5000 --restart=always --add-host=dockerhost:$(ip route | awk '/docker0/ { print $NF }') --name docker_registry -v ~/docker-registry/images:/var/lib/registry -v ~/docker-registry/config/config.yml:/etc/docker/registry/config.yml registry:2.1.1
config.yml 看起来像这样,配置为向我的应用程序端点发送 webhook 通知:8080 (appListener):
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
notifications:
endpoints:
- name: appListener
url: http://dockerhost:8080/event
headers:
Authorization:
timeout: 500ms
threshold: 5
backoff: 1s
docker_registry 中的错误日志:
time="2015-10-30T23:50:15Z" level=warning msg="httpSink{http://dockerhost:8080/event} encountered too many errors, backing off"
time="2015-10-30T23:50:16Z" level=error msg="retryingsink: error writing events: httpSink{http://dockerhost:8080/event}: error posting: Post http://dockerhost:8080/event: dial tcp 172.17.42.1:8080: connection refused, retrying"
谢谢。
【问题讨论】: