Get Docker application link into pm2

I have a problem connecting from my twitterservice to rabbitmq. When I run everything locally, it works perfectly. As soon as I use it with docker-compose, twitterservice doesn’t seem to be able to connect to rabbit. Error is eventually produced:

Socket closed abruptly during opening handshake.

  • How much maximum heap space does a Play Framework App use per default
  • How to launch my docker container automatically on ECS?
  • Live migration of a jboss/wildfly container with CRIU failed
  • How to docker container requirements network from host
  • Docker swarm mode load balancing not working as described
  • Secure distribution of private keys to Docker on CoreOS
  • The Mongo Part works btw.

    I have my docker-compose.yml file:

        version: '2'
    services:
      twitterservice:
        build: ./workerTwitter
        links:
          - mongodb:mongolink
          - rabbitmq:rabbitlink
        ports:
          - "8080:8080"
        depends_on:
          - mongodb
          - rabbitmq
      mongodb:
        image: mongo:latest
        ports:
          - "27017:27017"
        volumes:
          - mongo-data:/var/lib/mongo
        command: mongod
      rabbitmq:
        image: rabbitmq:management
        ports:
          - '15672:15672'
    volumes:
      mongo-data:
        driver: local
    

    Which launches perfectly.

    My pm2 processes.json:

        {
        "apps": [
            {
                "name": "twitter-service",
                "script": "./src",
                "merge_logs": true,
                "max_restarts": 40,
                "restart_delay": 10000,
                "instances": 1,
                "max_memory_restart": "200M",
                "env": {
                    "PORT": 8080,
                    "NODE_ENV": "production",
                    "MONGO_DB": "mongodb://mongolink:27017/",
                    "RABBIT_MQ": "amqp://rabbitlink:15672/",
                }
            }
        ]
    }
    

    When my application launches it doesn’t connect to Rabbit, because it seems to be missing the right link (IP). I can access the Rabbit management console and can see that there are now ques created How can I access the generated app from within the processes.json?

  • Exposing ipv6 ports in docker containers
  • Docker, strange issue with permissions in copied resources
  • marathon docker jobs hanged in deployment state
  • Reduce SYS_ADMIN Linux capabilities
  • How to setup Docker for a polyglot microservice-based application?
  • Electron development on Windows using Docker?
  • One Solution collect form web for “Get Docker application link into pm2”

    The problem was that the app was trying to connect to rabbit before it was properly started and also on a wrong port. Port 5672 was the right one.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.