2

我已经成功部署了一个本地 docker 注册表并实现了一个侦听器端点,以使用示例 不安全配置文件按照配置文档接收事件通知。推送、拉取和列出图像效果很好。但是,我仍然没有收到任何事件通知。注册表日志抛出一些我不太明白的错误:

level=error msg="retryingsink: error writing events: httpSink{http://localhost:5050/event}: error posting: Post http://localhost:5050/event: dial tcp 127.0.0.1:5050: getsockopt: connection refused, retrying"

我会很感激任何信息。

端点监听器是用java实现的

@RequestMapping(value="/event",method = RequestMethod.POST,consumes = "application/json")
public void listener(@RequestBody Events event) {

Event[] e = event.getEvents();
Event ee = new Event();

for (int i = 0; i < e.length; i++) {
    System.out.println(e.length);
    System.out.println(e[i].toString());

}
4

1 回答 1

0

因此,经过几个小时的研究,即检查私有注册表日志,我意识到注册表侦听器发布到通知端点的消息的媒体类型是application/octet stream或者application/vnd.docker.distribution.manifest.v2+json。因此,我的解决方案是允许使用此Spring 文档consumes = "*/*"中指定的注释的所有媒体类型,即

 @RequestMapping(value="/event",method = RequestMethod.POST,consumes =  "*/*")
于 2018-02-04T00:06:45.380 回答