0

I'm using Docker-compose in my project when i'm trying to inside a project to connect to a host in my VBox "localhost:22000" it causes an Exception connection refused

version: '2'
services:
  mongodb:
    image: mongo
    ports:
      - "27017:27017"
    command: mongod --smallfiles

  rabbitmq:
    image: rabbitmq:3.5.3-management
    ports:
      - "5672:5672"
      - "15672:15672"
  broker:
    image: java:openjdk-8u91-jdk
    depends_on: 
      - mongodb
      - rabbitmq
    working_dir: /app
    volumes:
      - ./blockchain-rabbitmq/target/:/app
    command: java -jar /app/blockchain-rabbitmq-0.0.1.jar
    ports:
      - "8484:8484"
    links:
      - rabbitmq
      - mongodb
    environment:
      SPRING_DATA_MONGODB_URI: mongodb://mongodb/ethereum
      RABBIT_HOST: rabbitmq
      SPRING_RABBITMQ_HOST: rabbitmq
  nfb:
    image: java:openjdk-8u91-jdk
    depends_on: 
      - mongodb
      - broker
    working_dir: /app
    volumes:
      - ./coordinator/target/:/app
    command: java -jar /app/coordinator-0.0.1.jar
    ports:
      - "8383:8383"
    links:
      - mongodb
    environment:
      SPRING_DATA_MONGODB_URI: mongodb://mongodb/ethereum

is there a way to expose some hosts or port ( i got this kind of exception before that when i'm dealing with mongo and rabbit mq and i resolved it buy using links and env vars )

MyHMEG
  • 131
  • 1
  • 10
  • 1
    Nothing shown in your compose file mentions port 22000. Where is it listening? – Dan Lowe Jul 15 '17 at 22:23
  • in fact i have a network deployed in Virtual machine in VBox ! when i run my app without docker it works but with docker it causes this exception – MyHMEG Jul 15 '17 at 22:37
  • 1
    If you're trying to connect out from a container to the vbox VM using localhost, it won't work. Each container has its own independent localhost interface. [This question](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) may be helpful. – Dan Lowe Jul 15 '17 at 22:39
  • ah thank you very much that was very helpful – MyHMEG Jul 16 '17 at 11:16

0 Answers0