I have this docker-compose.yml snippet which is intended to expose a SOAP endpoint in Java built by Maven to other docker images (not included in snippet, but they work):
mocksumma:
image: openjdk:9-jdk
ports:
- "56808:56808"
expose: [56808]
volumes:
- ./mocksumma/target/mocksumma-1.0-SNAPSHOT.jar:/mocksumma.jar
#command: "sleep 10000000000"
command: "java --add-modules java.se.ee -jar /mocksumma.jar 'http://localhost:56808/mediehub/search/services/SearchWS?wsdl'"
I would also like to access this from my host environment (Ubuntu 17.04, docker compose 1.8.1, docker 1.12.6), but when accessing http://localhost:56808 I get either connection closed or ERR_SOCKET_NOT_CONNECTED. The web service has been confirmed to be responsive using "telnet localhost 56808" inside the container itself). Telnet from the host immediately returns connection closed:
$ telnet localhost 56808
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.
My theory is that for some reason the port is not exposed or forwarded (ports) to the host, because I have either overlooked or misunderstood something.
Suggestions?