I have a super simple docker-compose file:
services: app: container_name: myapp build: context: . dockerfile: Dockerfile depends_on: - myapp-redis - myapp-partner ports: - 1967:1967 restart: unless-stopped networks: - backend myapp-partner: container_name: myapp-partner build: context: . dockerfile: Dockerfile-Partner restart: unless-stopped networks: - backend myapp-redis: container_name: myapp-redis restart: always image: redis:6.0.5 networks: - backend networks: backend: driver: bridge
If i port-forward x:y (aka ports
config), i can access all services in my host machine's localhost
And also it is possible to telnet myapp-partner
from myapp
container console.
But when i simply try to connect web socket (ws://myapp-partner:8080/quotes
)from the running Java app in myapp
container i get connection refused
error.
I have checked the network, all containers are attached themselves succesfully into it and like i said telnet communication is successful via command-lines.
What can be the problem?
(host network-mode works but then myapp
becomes unreachable on localhost:1967
)