5

I am working with Docker containers and live streaming of text/event-stream events. I am using this example here. When I deploy that example as a Java EE WAR on a TomCat server on my local machine, everything works fine, and I see the Webpage updating live when the server sends random event data.

Event stream example running on TomCat locally

Server side code for the event streaming

When I deploy this example inside a Docker container based off a TomCat image though, like so:

docker run -d --name tomcateventstream -p 8081:8080 -P -v ~/Coding/Java/webapp:/usr/local/tomcat/webapps tomcat

In this latter case the example doesn't work. The events are apparently canceled, as shown in these pictures below:

Running in a Docker container on the local machine

Event stream getting canceled

Any idea why? I've searched quite a lot around this topic, I've even tried publishing all ports on the Docker side of things, but to no avail. I'm sure I'm missing something very small somewhere, something with the default Docker settings. Any help would be greatly appreciated. Thanks in advance!

Ambidextrous
  • 810
  • 6
  • 14

0 Answers0