0

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)

5
  • What network interface does your code bind to? Commented Jun 21, 2020 at 8:54
  • Not sure if i understood the question correctly but it is basically org.java_websocket.WebSocket and all components connects each other succesfully when i throw away docker. @ThorbjørnRavnAndersen
    – cek
    Commented Jun 21, 2020 at 9:00
  • Are all ports exposed in the dockerfiles? Commented Jun 21, 2020 at 9:03
  • Yes exactly @ThorbjørnRavnAndersen. 8080 for myapp-partner and 6379 for redis.
    – cek
    Commented Jun 21, 2020 at 9:05
  • Show the code that creates the websocket in myapp-partner. Commented Jun 21, 2020 at 9:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.