Search code examples
dockerdocker-composerabbitmqinfluxdb

Port exposed with docker run but not docker-compose up


I am trying to run rabbitmq along with influxdb TICK stack with docker-compose. When I run rabbitmq with this command:docker run -d --rm -p 5672:5672 -p 15672:15672 rabbitmq:3-management, both ports are open and I am able to access from a remote machine. However, when I run rabbitmq as part of a docker-compose file, it is not accessable from a remote machine. Here is my docker-compose.yml file:

version: "3.7"

services:
  influxdb:
    image: influxdb
    volumes:
      - ./influxdb/influxdb/data/:/var/lib/influxdb/
      - ./influxdb/influxdb/config/:/etc/influxdb/
    ports:
      - "8086:8086"

  rabbitmq:
    image: rabbitmq:3-management
    volumes:
      - ./rabbitmq/data:/var/lib/rabbitmq
    ports:
      - "15672:15672"
      - "5672:5627"

  telegraf:
    image: telegraf
    volumes:
      - ./influxdb/telegraf/config/:/etc/telegraf/
      - /proc:/host/proc:ro
    depends_on:
      - "influxdb"
      - "rabbitmq"

  chronograf:
    image: chronograf
    volumes:
      - ./influxdb/chronograf/data/:/var/lib/chronograf/
    ports:
      - "8888:8888"
    depends_on:
      - "telegraf"

More information: when I run this with docker-compose up -d the 8086 and 8888 are accessible from a remote machine (I confirm with using nmap command). Also, either way I am able to access the rabbitmq management console at http://localhost:15672.

How can I set this up so I can access rabbitmq from a remote machine using docker-compose?

Thank you.


Solution

  • Looks like just a typo in the port mapping in docker-compose.yml: 5672:5627 should actually be 5672:5672.

    Otherwise the docker-compose configuration looks just fine.