2

I have successfully deployed a local docker registry and implemented an listener endpoint to receive event notifications following the documentation for configuration using a sample insecure configuration file. Pushing, pulling and listing images work well. However, i still receive no event notification. The registry logs are throwing some errors i do not really understand:

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"

I will appreciate any info.

The endpoint listener is implemented in 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());

}
SyCode
  • 1,077
  • 4
  • 22
  • 33
  • check https://stackoverflow.com/questions/40789456/error-response-from-daemon-getsockopt-connection-refused – Yohannes Gebremariam Feb 02 '18 at 23:35
  • @YohannesGebremariam the referred answer is different to my issue. I can list,pull and push images. Also I have not configured certificates since this is optional. I might have an issue with writing registry events to the listener. – SyCode Feb 02 '18 at 23:55

1 Answers1

0

So after several hours of research i.e. inspecting the private registry logs, i realized the media-type of the messages posted by registry listener to notification endpoints is either application/octet stream or application/vnd.docker.distribution.manifest.v2+json. Hence my solution was to permit all media types using the annotation consumes = "*/*" as specified in this Spring documentation i.e.

 @RequestMapping(value="/event",method = RequestMethod.POST,consumes =  "*/*")
SyCode
  • 1,077
  • 4
  • 22
  • 33