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 to make docker container be notified when volume from another container was updated?
  • Docker: updating image and registry
  • Private docker registry and high availability
  • Ansible ignores remote_user switch
  • Connecting from php to mysql in Docker
  • Does all running docker containers have a separate process ID
  • 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?

  • Mesos API for starting and stopping Slave nodes
  • What are proven options for using ZFS remotely as a volume backend for docker?
  • NuGet with Mono on Linux: Error getting response stream
  • Unable to mount specific paths as volumes
  • Redis Docker - Unable to connect from C# client
  • Docker, can't reach “rails server” development from localhost:3000 using docker flag -p 3000:3000
  • 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.